users@jaxb.java.net

xsd sequence

From: Amit G Soni <Amit.G_at_mphasis.com>
Date: Fri, 18 Jul 2008 16:35:25 +0530

Hi List,

 

I am using JAXB-1.0.5 for Marshaling and Unmarshaling.

 

Currently I am having problem with the sequence of elements within the
element of XSD. Please consider following scenario.

 

The XSD contains the complex element as

 

<xsd:complexType name="MyObject">

            <xsd:sequence>

<xsd:element name="A" type="xsd:string" minOccurs="0"
maxOccurs="unbounded"/>

<xsd:element name="B" type="xsd:string" minOccurs="0"
maxOccurs="unbounded"/>

<xsd:element name="C" type="xsd:string" minOccurs="0"
maxOccurs="unbounded"/>

` </xsd:sequence>

</complexType>

 

But the xml which I am getting in which the order of Element A or B or C
(under complexType MyObject) is not in given sequence of XSD. It is
coming in any sequence

 

Eg.

<MyOBject>

            <C>Element </C>

<A>Element </A>

<B>Element </B>

</MyOBject>

 

 

<MyOBject>

            <B>Element </B>

<C>Element </C>

<A>Element </A>

</MyOBject>

 

and because of this at the time of unmarshall I am getting parsing
error. Can any one has any idea how can I resolve this problem.

 

Thanks,

Amit Soni