Hello,
I already asked this on other forum without luck, the thread is dead so i try it here.
this is the class containing the data:
@XmlRootElement()
public class SettingsData implements Serializable
{
private static final long serialVersionUID = 1L;
private ArrayList<String> bezeichnungAL = new ArrayList<String>();
public SettingsData()
{
}
// setXX()
public void setBezeichnungAL(String bezeichnungAL)
{
// String an bezeichnungAL anh�ngen...
this.bezeichnungAL.add(bezeichnungAL);
}
}
this is an outline of the code where i marshall the java data to .xml file:
IN this code i read the strings in the combobox into the ArrayList by using the setBezeichnungAL(xxx) method. to make sure that the data was written properly into the ArrayList of the SettingsData.class i output the data in the next code lines with the 2nd for loop and yes the data contained in the JCombobox is in the ArrayList so everything i did was ok but when i open my .xml file after marshalling the java data i can see everything except any information about my ArrayList in the .xml file ??? What DO I WRONG ? please help me.
try
{
JAXBContext jc = JAXBContext.newInstance(SettingsData.class);
Marshaller m = jc.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
OutputStream os = new FileOutputStream("settings.xml");
SettingsData object = new SettingsData();
for(int i = 0 ; i < bezeichnungCB.getItemCount() ; i++ )
{
object.setBezeichnungAL(bezeichnungCB.getItemAt(i).toString());
}
for(int i = 0; i < object.getBezeichnungAL().size(); i++)
{
System.out.println(object.getBezeichnungAL().get(i));
}
m.marshal(object, os);
os.close();
}