[xsd-users] Re: A Question about elements sequence
Boris Kolpackov
boris at codesynthesis.com
Mon Aug 11 02:57:08 EDT 2008
Hi,
lvkun <lvkun2006 at gmail.com> writes:
> The example xsd file is:
> <xs:element name= "book">
> <xs:complexType>
> <xs:sequence >
> <xs:element name= "title" type= "xs:string"/>
> <xs:element name = "author" type= "xs:string"
> minOccurs= "1" maxOccurs= "unbounded"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> But when I parse the xml file, the element sequence is not fixed. Maybe like
> this:
> <book>
> <author>
> A
> </author>
> <author>
> B
> </author>
> <title>
> AAAA
> </title>
> </book>
> So, when I use xsd to parse this file, it throw exception. How to solve this
> problem?
Your XML document is not valid per your schema since your schema says
elements should be in the specified order. To solve this, you can either
fix your XML document or change your schema.
Boris
More information about the xsd-users
mailing list