You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Eamonn Rohan <ea...@aerospacedevelopments.com> on 2006/03/09 12:36:59 UTC

Schema generator not generating certain classes.

Hi everyone,

I'm developing an application that takes in a schema defined by a third 
party and uses XML beans
to parse out the content and also to create the same messages from data 
in the app.

Each xsd file defining a particular message (of which there are about 
17) uses an include statement
to another schema containing common types and this in turn links to a 
third file containing dictionary definitions for each
element (some of them end up being enumerations etc.).

My problem arises when i try to compile an xsd file like this:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.00" 
id="R2005.1">
    <xs:include schemaLocation="CommonTypes.xsd"/>
    <xs:element name="Order">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="OrderHeader" type="MessageHeaderType"/>
                <xs:element name="OrderDetails" maxOccurs="unbounded">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element ref="ELEMENT1"/>
                            <xs:element ref="ELEMENT2"/>
                            ...
                            <xs:element ref="ELEMENT17"/>
                            <xs:element ref="REMARKS" minOccurs="0"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
            <xs:attribute ref="version" use="required"/>
        </xs:complexType>
    </xs:element>
</xs:schema>

The generator gives me a separate document for each Element in the 
dictionary file as I would expect it to and also
documents for each of the complex types defined in CommonTypes.xsd 
(including one for MessageHeaderType above).
In my OrderDocument interface I get a nested interface for Order which 
includes methods like:
addNewOrderHeader which returns a MessageHeaderType, setOrderHeader 
which takes in a MessageHeaderType..., however
I also get generated methods for OrderDetailsArray (addNew, set, remove 
etc.) that refer to a data type
noNamespace.OrderDocument.Order.OrderDetails which is itself not 
generated at all.  This means I get no getters or setters for any of the
elements at all and therefore no way to add a new OrderDetails line.

I have managed to get around this problem by taking the complex type 
contained in the OrderDetails section and putting it's contents into
the CommonTypes.xsd file as OrderDetailsType so that the Orders.xsd file 
looks like:
       ...
        <xs:complexType>
            <xs:sequence>
                <xs:element name="OrderHeader" type="MessageHeaderType"/>
                <xs:element name="OrderDetails" type="OrderDetailsType" 
maxOccurs="unbounded" />
            </xs:sequence>
            <xs:attribute ref="version" use="required"/>
        </xs:complexType>
       ...

I was wondering if anyone could shed some light as to why this is 
happening (is it something I am doing wrong or a shortcoming of the 
application?)
and how I can avoid having to hack at the schemas to get them to compile 
correctly.

I am looking at a situation whereby there may be several revisions of 
the schemas throughout the year and I would prefer if at all possible
not to have to change them each and every time a new one gets published.

Thank you in advance.

Regards

Eamonn


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