Re: Need something like xs:sequence without order?

Michael Kay's Saxon has support for at least much of XSD 1.1.   I assume 
but do not know for a fact that it supports SAX.  Michael follows this 
list, I think, so he can give you more details if you don't find them 
online.

Noah

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------








Felix Nensa <nensa@zeec.biz>
01/28/2010 07:09 PM
 
        To:     noah_mendelsohn@us.ibm.com
        cc:     xmlschema-dev@w3.org, xmlschema-dev-request@w3.org
        Subject:        Re: Need something like xs:sequence without order?


Thank you for your reply.

In schema 1.0:

       <xsd:choice minOccurs="0" maxOccurs="unbounded">
               <xsd:element ref="A" />
               etc.
          ....references to A,B,C

This is quite exacly what I am doing right now as a workaround.. with the 
downsides you describe.
 
In schema 1.1:

       <xsd:all>
               <xsd:element ref="A" />
               [...]
               <xsd:element ref="D" minOccurs="0" maxOccurs="2>

In other words, in schema 1.0, you can use choice, but you don't get to
tightly control the number of occurrences of each named element.   Schema
1.1 can do the same, but it also allows you to use <xsd:all> with explicit
occurrence counts.  That could enforce, for example, that you wanted at
most two "D" elements, regardless of order with respect to the others.
Note that XSD 1.1 is still in Candidate Recommendation status and is not
yet widely deployed.


Do you know if there is any validating SAX parser for java that supports 
Schema 1.1? I would like to give it a try.
 
Thanks for your help,

Felix




Felix Nensa <nensa@zeec.biz>
Sent by: xmlschema-dev-request@w3.org
01/28/2010 12:04 PM

       To:     xmlschema-dev@w3.org
       cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
       Subject:        Need something like xs:sequence without order?


Hi experts,

I have some tricky XML that needs to be validated against an XSD, that I
am not sure how to define.
The XML could come in several variations. Some examples:

Example 1:

<SomeElement>
 <A>aaa</A>
 <B>bbb</B>
 <C>ccc</C>
 <D>ddd</D>
 <D>dde</D>
</SomeElement>

Example 2:

<SomeElement>
 <B>bbb</B>
 <A>aaa</A>
 <C>ccc</C>
 <D>ddd</D>
 <D>dde</D>
</SomeElement>

Example 3:

<SomeElement>
 <B>bbb</B>
 <A>aaa</A>
 <D>ddd</D>
 <D>dde</D>
</SomeElement>


The corresponding XSD that I would like to define (but of course is
invalid) would look like this:

<xs:element name="SomeElement">
 <xs:complexType>
   <xs:all>
    <xs:element name="A" type="xs:string" minOccurs="1" maxOccurs="1" />
    <xs:element name="B" type="xs:string" minOccurs="1" maxOccurs="1" />
    <xs:element name="C" type="xs:string" minOccurs="0" maxOccurs="1"
/>
    <xs:element name="D" type="xs:string" minOccurs="1"
maxOccurs="unbounded" />

   </xs:all>
 </xs:complexType>
</xs:element>

Any ideas how to achive the same with valid XSD?
Thanks in advance,

Felix

Received on Friday, 29 January 2010 01:57:05 UTC