- From: Felix Nensa <nensa@zeec.biz>
- Date: Fri, 29 Jan 2010 01:09:45 +0100
- To: noah_mendelsohn@us.ibm.com
- Cc: xmlschema-dev@w3.org, xmlschema-dev-request@w3.org
- Message-ID: <b06e2691001281609ne75a658rcbd121f4600bd975@mail.gmail.com>
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 00:10:14 UTC