I work with static generated SDO classes.
When saving an object containing a list of nested objects to XML, the nested
objects are not correctly saved to XML.
It looks like the toString method is called for the objects in the nested list,
insted of "xml save".
This is the sample output XML:
<name>dept1</name>
<Employees>[EMAIL PROTECTED] (name: empl1)</Employees>
</Output>
This is the corresponding xsd I used:
<?xml version="1.0" encoding="UTF-8"?>
targetNamespace="http://xyz.com"
xmlns:tns="http://xyz.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="department" type="DepartmentType"/>
<xsd:complexType name="DepartmentType">
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
<xsd:sequence>
<xsd:element name="Employees" type="EmployeeType"
maxOccurs="unbounded"></xsd:element>
</xsd:sequence>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="EmployeeType">
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
This is the test java code I used:
DepartmentType d = XyzFactory.INSTANCE.createDepartmentType();
d.setName("dept1");
EmployeeType e = XyzFactory.INSTANCE.createEmployeeType();
e.setName("empl1");
d.getEmployees().add(e);
System.out.println(HelperProvider.getDefaultContext().getXMLHelper().save((DataObject)d,
null, "Output"));
Thanks,
Daniel.
__________________________________ Alles was der Gesundheit und
Entspannung dient. BE A BETTER MEDIZINMANN! www.yahoo.de/clever