I believe that by setting minOccurs="0", the parent complex-type will, by
default, not create any instance.

If you require at least one instance of the child complex type, remove the
minOccurs attribute or set it to 1.

I generated through an XSD and it worked fine, but I do not specify the
minOccurs attribute when I require at least one instance of a child
complex-type.

Hope that helps.

Vincent Gigu�re
 

-----Original Message-----
From: Reto Kummli [mailto:[EMAIL PROTECTED] 
Sent: 1 juin 2004 10:52
To: [EMAIL PROTECTED]
Subject: [castor-user] Castor XML: Automatic Data Object Creation?

Hi,

We use the Castor XML Code Generation tool to generate classes to access our
XML files (using an XSD file). We use those XML files to store configuration
data for our server application.
 
Our goal is: 
After the initial creation of the XSD file or after performing a change in
the XSD file, we don't want either to adapt our XML file manually nor to
write/adapt the code to create instances of the (new) data objects,
generated castor classes.

My question:
Is there a way that castor automatically creates the data objects using the
default values given by the XSD file respectively using the default
constructor for the appropriate classes ? 
The creation of data object and initializing their attributs with the
default values works well but as soon as we use complex-types containing
other complex-types, the created class does contain an attribute to the the
child complex-type but no object of that type is being created. But as
mentioned, I don't want to program the creation of the whole given data
structure.

Example:
------------------------------------------------------------
Extract from our XSD file:

<xs:complexType name="listenerType">
  <xs:all>
    <xs:element name="address" type="addrType" minOccurs="0"/>
  </xs:all>
</xs:complexType>
 .

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to