Thanks for the tip -- I'll ask on the w3.org list. I can't change "sequence"
to "all" because then minOccurs and maxOccurs for the child elements
(father, mother, etc.) must be 0 or 1 when using "all", and I need them to
occur more than just once.


-----Original Message-----
From: Mik Lernout [mailto:[EMAIL PROTECTED]
Sent: Monday, August 23, 2004 7:27 AM
To: [EMAIL PROTECTED]
Subject: Re: XML Schema


Hey,

The mailing list your question should be directed to is the 
xmlschema-dev mailing list at www.w3.org.
The fact that the order is validated has to do with the sequence you 
have defined in your schema, if you change 'sequence' to 'all' you will 
achieve what you want.
I should add though that there is a real tendency for schema's to use 
fixed-order as much as possible: it eases development against the schema 
and allows highly optimized validation techiniques...

Hope that helps,

Mik


Asleson, Ryan wrote:

>Hello,
>
>My apologies if this isn't the correct place to ask this question, but I
>didn't know where else to go.  
>
>Suppose I have a simple XML document that looks like this:
>
><?xml version="1.0"?>
><family>
>       <father>Jack</father>
>       <mother>Jill</mother>
>       <son>Billy</son>
>       <son>Joey</son>
>       <daughter>Jane</daughter>
>       <pet>Fido</pet>
></family>
>
>
>The above XML is successfully validated by the schema shown below:
>
>
><?xml version="1.0"?>
><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
>
>    <xs:element name="father" type="xs:string"/>
>    <xs:element name="mother" type="xs:string"/>
>    <xs:element name="son" type="xs:string"/>
>    <xs:element name="daughter" type="xs:string"/>
>    <xs:element name="pet" type="xs:string"/>
>    
>    <xs:element name="family">
>        <xs:complexType>
>            <xs:sequence>
>                <xs:element ref="father" minOccurs="0"/>
>                <xs:element ref="mother" minOccurs="0"/>
>                <xs:element ref="son" minOccurs="0" maxOccurs="unbounded"/>
>                <xs:element ref="daughter" minOccurs="0"
>maxOccurs="unbounded"/>
>                <xs:element ref="pet" minOccurs="0" maxOccurs="unbounded"/>
>            </xs:sequence>
>        </xs:complexType>
>    </xs:element>
></xs:schema>    
>
>
>However, if the XML document is changed so that the "pet" element occurs
>before the "daughter" element, a validation error is thrown.  The error
>states that all instances of "pet" must occur after any instances of
>"daughter."
>
>This is the problem.  I don't want the order of child elements within the
>"family" element to matter, or be validated.  I don't care what order the
>father, mother, son, daughter, and pet tags are in, nor do I want to
>validate the order.
>
>How can I specify this in the XML schema?  According to the documentation
>I've seen, the complexType tag must use an occurrence indicator of all,
>choice, or sequence.  All might work, since order doesn't matter, but
>apparently it specifies that each child element can occur once and only
once
>once, which doesn't work.  Choice doesn't work because only one of the
>elements can appear.  Sequence might work because it allows me to specify
>multiple occurrences of child elements, but it enforces the order of the
>child elements, which I don't want.
>
>How can I specify this complex type in the XML schema?  I'm sure it can be
>done, I'm just not sure how.
>
>Thank you very much!!
>
>
>
>This e-mail message is being sent solely for use by the intended
recipient(s) and may contain confidential information.  Any unauthorized
review, use, disclosure or distribution is prohibited.  If you are not the
intended recipient, please contact the sender by phone or reply by e-mail,
delete the original message and destroy all copies. Thank you.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>  
>


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

This e-mail message is being sent solely for use by the intended recipient(s) 
and may contain confidential information.  Any unauthorized review, use, 
disclosure or distribution is prohibited.  If you are not the intended 
recipient, please contact the sender by phone or reply by e-mail, delete the 
original message and destroy all copies. Thank you.

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

Reply via email to