JAXB parsing problem

S

sblev

Hi all,

I hope someone can help me with the following:

I want to use JAXB in order to quickly load (unmarshel) an XML file
into
java objects. For that, I need to create an XSD file that conforms to
the
XML.
I have a problem generating that XSD for the following XML snippet:

<A>
<B/>
<B/>
<C/>
<B/>
<C/>
</A>

Note that <B> and <C> elements that are inside <A> may appear zero or
more
times and their order is unknown.
The issue is that the XSD order indicators (<all>, <choice> and
<sequence>)
do not permit this kind of structure, and unmarshalling fails.
Can someone please point out to me how to write such an XSD? or maybe
even
the snippet does not conform to correct XML rules?

Thank you,

Barry
 
M

Martin Honnen

Hi all,

I hope someone can help me with the following:
I have a problem generating that XSD for the following XML snippet:

<A>
<B/>
<B/>
<C/>
<B/>
<C/>
</A>

Note that <B> and <C> elements that are inside <A> may appear zero or
more
times and their order is unknown.
The issue is that the XSD order indicators (<all>, <choice> and
<sequence>)
do not permit this kind of structure,

<xs:element name="A">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="B"/>
<xs:element name="C"/>
</xs:choice>
</xs:complexType>
</xs:element>

should do as a schema. I don't know whether it helps with JAXB however.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top