Title: XSD complexTypes and source generation.

Hi,

 

The way Castor handles elements and complex types can be changed.

 

Basically this is due to authoring style of schemas.

 

Try changing the following setting and see if this suite you better.

 

http://www.castor.org/sourcegen.html#The-'type'-method

 

Andy.

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 08 July 2005 07:02
To: [email protected]
Cc: [EMAIL PROTECTED]
Subject: [castor-user] XSD complexTypes and source generation.

 

Hi,

perhaps I am missing something, haven't read the manual enough, am overlooking something, but I have a question about the source generation and the use of complex types in relation to the code generated. In short, why doesn't castor use the complex type for input and output parameters, but instead does it use generated classes named after the element name.

Considering the following example:

<xs:complexType name="Person">
        <xs:sequence>
                <xs:element name="Gender" type="xs:string"/>
                <xs:element name="Age" type="xs:int"/>
                <xs:element name="Name" type="xs:string"/>
        </xs:sequence>
</xs:complexType>

<xs:complexType name="HappyFamily">
        <xs:sequence>
                <xs:element name="Mom" type="Person">
                <xs:element name="Dad" type="Person">
                <xs:element name="Child" type="Person" minOccurs="0" maxOccurs="unbounded">
                <!-- hardly realistic :-) -->
        </xs:sequence>
</xs:complexType>

 

Why does castor generate a class for each element of the HappyFamily complex type?
Why doesn't it only generate classes for each used complex type?
Why does it generate accessors that use the element name as input and output classes instead of the element type?

In other words, why does castor generate the classes Mom, Dad, Child (extending Person).
And why does castor generate code that require those classes instead of the type they are?

In java:

HappyFamily family = new HappyFamily();
family.setMom(new Mom());

Why can't this be:

HappyFamily family = new HappyFamily();
family.setMom(new Person());

Thanks,

Rutger Lubbers





The information in this message is confidential and may be legally privileged. It may not be disclosed to, or used by, anyone other than the addressee. If you receive this message in error, please advise us immediately.

Internet emails are not necessarily secure. CODA does not accept responsibility for changes to any email which occur after the email has been sent. Attachments to this email may contain software viruses, which could damage your systems. CODA has checked the attachments for viruses before sending, but you should virus-check them before opening.

Reply via email to