You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Daniel Peter <dp...@yahoo.de> on 2007/07/16 15:05:00 UTC

XML save problem with static generated SDO classes

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>com.xyz.impl.EmployeeTypeImpl@1ea7f752 (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

Re: XML save problem with static generated SDO classes

Posted by Frank Budinsky <fr...@ca.ibm.com>.
Hi Daniel,

This seems like a very basic function that isn't working. What version of 
Tuscany are you using? I wonder if this has been broken, as a side effect 
of one of the recent generator changes? (we really need to get some static 
SDO regression tests into the build).

Please note that you need to regenerate you classes with the latest 
version of the generator, before running them.

Thanks,
Frank.

Daniel Peter <dp...@yahoo.de> wrote on 07/16/2007 09:05:00 AM:

> 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>com.xyz.impl.EmployeeTypeImpl@1ea7f752 (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

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org