Hi Ole,
What you are seeing is expected behavior for XMLBeans. The classes are
generated this way because of the schema design pattern you are using.
In your Tree xsd you are using the russian doll pattern while in your
flat file xsd you are using the salami slice pattern.

Here is some additional information on the patterns in case you are interested.
http://www.xfront.com/GlobalVersusLocal.pdf
http://developers.sun.com/jsenterprise/nb_enterprise_pack/reference/techart/design_patterns.html

In answer to your question:
Is there any possibility to configure XMLBeans to generate a flat
class structure for a tree-structured xml schema?
Not AFAIK, however you may want to look into the venetian blind
pattern as you can work 'Type' classes in a manner like you are
seeking.

Hope this helps,
-Jacob Danner



On 9/6/07, Ole Laurisch <[EMAIL PROTECTED]> wrote:
>
>
>
>
> Hello,
>
>
>
> I have a problem when I try to generate a jar for an xml schema which is
> organized like a tree. To make clear what I mean I post two examples:
>
>
>
> Flat xml schema:
>
>
>
> <xs:schema attributeFormDefault="unqualified"
> elementFormDefault="qualified" targetNamespace="http://someurl.org";
> xmlns:xs="http://www.w3.org/2001/XMLSchema";>
>
>   <xs:element name="description">
>
>     <xs:complexType>
>
>       <xs:sequence>
>
>         <xs:element name="pagesequence" />
>
>       </xs:sequence>
>
>     </xs:complexType>
>
>   </xs:element>
>
>   <xs:element name="pagesequence">
>
>     <xs:complexType>
>
>       <xs:sequence>
>
>         <xs:element maxOccurs="unbounded" name="page" />
>
>       </xs:sequence>
>
>       <xs:attribute name="name" type="xs:NCName" use="required" />
>
>     </xs:complexType>
>
>   </xs:element>
>
>   <xs:element name="page">
>
>     <xs:complexType>
>
>       <xs:sequence>
>
>         <xs:element minOccurs="0" maxOccurs="unbounded" name="textfield" />
>
>         <xs:element minOccurs="0" maxOccurs="unbounded" name="textarea" />
>
>       </xs:sequence>
>
>       <xs:attribute name="description" type="xs:NCName" />
>
>       <xs:attribute name="name" type="xs:NCName" use="required" />
>
>     </xs:complexType>
>
>   </xs:element>
>
>   <xs:element name="textfield">
>
>     <xs:complexType>
>
>       <xs:attribute name="label" type="xs:NCName" use="required" />
>
>     </xs:complexType>
>
>   </xs:element>
>
>   <xs:element name="textarea">
>
>     <xs:complexType>
>
>       <xs:attribute name="label" type="xs:NCName" use="required" />
>
>       <xs:attribute name="rows" type="xs:int" use="required" />
>
>     </xs:complexType>
>
>   </xs:element>
>
> </xs:schema>
>
>
>
>
>
> Tree xml schema:
>
>
>
> <xs:schema attributeFormDefault="unqualified"
> elementFormDefault="qualified" targetNamespace="http://someurl.org";
> xmlns:xs="http://www.w3.org/2001/XMLSchema";>
>
>   <xs:element name="description">
>
>     <xs:complexType>
>
>       <xs:sequence>
>
>         <xs:element name="pagesequence">
>
>           <xs:complexType>
>
>             <xs:sequence>
>
>               <xs:element maxOccurs="unbounded" name="page">
>
>                 <xs:complexType>
>
>                   <xs:sequence>
>
>                     <xs:element minOccurs="0" maxOccurs="unbounded"
> name="textfield">
>
>                       <xs:complexType>
>
>                         <xs:attribute name="label" type="xs:string"
> use="required" />
>
>                       </xs:complexType>
>
>                     </xs:element>
>
>                     <xs:element minOccurs="0" maxOccurs="unbounded"
> name="textarea">
>
>                       <xs:complexType>
>
>                         <xs:attribute name="label" type="xs:string"
> use="required" />
>
>                         <xs:attribute name="rows" type="xs:int"
> use="required" />
>
>                       </xs:complexType>
>
>                     </xs:element>
>
>                   </xs:sequence>
>
>                   <xs:attribute name="name" type="xs:string" use="required"
> />
>
>                   <xs:attribute name="description" type="xs:string"
> use="optional" />
>
>                 </xs:complexType>
>
>               </xs:element>
>
>             </xs:sequence>
>
>             <xs:attribute name="name" type="xs:string" use="required" />
>
>           </xs:complexType>
>
>         </xs:element>
>
>       </xs:sequence>
>
>     </xs:complexType>
>
>   </xs:element>
>
> </xs:schema>
>
>
>
>
>
> When I generate a jar for the flat schema I get all the classes I need
> (Description, PageSequence, Page, Textfield and so on). When I generate a
> jar for the tree-structured schema I get only one class (Description) with
> the inner class (interface) PageSequence, which has the inner class
> (interface) Page and so on.
>
>
>
> Because of better human readability I would prefer a tree-structured xml
> schema, but the programmers need single classes and not the nested inner
> classes.
>
>
>
> Is there any possibility to configure XMLBeans to generate a flat class
> structure for a tree-structured xml schema?
>
>
>
> Thanks in advance,
>
> Ole Laurisch
>  ________________________________
>  Resco GmbH
>  Geschäftsführer: Michael Mörchen
>  Amtsgericht Hamburg, HRB 76048
>  Ust.Ident-Nr.:DE208833022
>
>  Haftungsausschluss: Diese Nachricht ist ausschließlich für die Person
> oder Einheit bestimmt, an die sie gerichtet ist. Sie enthält unter
> Umständen Informationen, die unter geltendem Recht vertraulich, gesetzlich
> geschützt oder von der Offenlegung ausgeschlossen sind. Falls Sie nicht der
> vorgesehene Empfänger oder verantwortlich für die Weiterleitung dieser
> Nachricht an den vorgesehenen Empfänger sind, ist es Ihnen strengstens
> untersagt, diese Nachricht offenzulegen, zu verteilen, zu kopieren oder in
> irgendeiner Art zu benutzen. Sollten Sie diese Nachricht versehentlich
> erhalten haben, benachrichtigen Sie bitte den Absender und löschen und
> vernichten Sie jegliche Kopie davon, die Sie möglicherweise erhalten haben.
>
>  Disclaimer: This message is intended only for the use of the individual or
> entity to which it is addressed and may contain information which is
> privileged, confidential, proprietary, or exempt from disclosure under
> applicable law. If you are not the intended recipient or the person
> responsible for delivering the message to the intended recipient, you are
> strictly prohibited from disclosing, distributing, copying, or in any way
> using this message. If you have received this communication in error, please
> notify the sender and destroy and delete any copies you may have received.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to