Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: Ignore Order while validating XSD

From: "Ralf Lammel" <Ralf.Lammel@---------.--->
To: "Mukul Gandhi" <gandhi.mukul@-----.--->, "Ramkumar Menon" <ramkumar.menon@-----.--->
Date: 2/18/2006 6:45:00 PM
> I am curious, is the validation happening correctly(for the case a, b,
> c), or is this bug in the validator?

You would need to use left factorization if the approach for exhaustive
enumeration of permutations is meant to cope with UPA.

Here is the concise EBNF demo.
Suppose you want all permutations of A, B+, C.
In EBNF with permutation phrases (say "||") you would write:

S -> A||B+||C

(S being the start symbol.)

In EBNF without "||" and with the goal to use LL(1), you would write:

S -> A ( B+ C | C B+ ) | B+ ( A C | C A) | C ( A B+ | B+ A)

I am not commenting on the scalability of this approach. :-)

HTH
Ralf Laemmel
Microsoft, Webdata/XML
http://www.cwi.nl/~ralf


> -----Original Message-----
> From: xmlschema-dev-request@w...
[mailto:xmlschema-dev-request@w...]
> On Behalf Of Mukul Gandhi
> Sent: Saturday, February 18, 2006 11:39 PM
> To: Ramkumar Menon
> Cc: xmlschema-dev@w...
> Subject: Re: Ignore Order while validating XSD
> 
> 
> You can try something like this. i.e. use xs:choice to select one
> among all the permutations.
> 
> <xs:element name="x">
>   <xs:complexType>
>      <xs:choice>
>        <xs:sequence>
>            <xs:element name="a" type="xs:string"/>
>            <xs:element name="b" type="xs:string"
maxOccurs="unbounded"/>
>        </xs:sequence>
>        <xs:sequence>
>            <xs:element name="b" type="xs:string"
maxOccurs="unbounded"/>
>            <xs:element name="a" type="xs:string"/>
>        </xs:sequence>
>      </xs:choice>
> </xs:complexType>
> 
> This works for this simple case. But once I make it slightly more
> complex as shown below (by introducing another element c), the XSD
> validator(XMLSpy 2006) reports that schema is not valid. It says
> "content model is non-deterministic. Possible causes: name equality,
> overlapping occurence or substitution groups".
> 
> <xs:element name="x">
>    <xs:complexType>
>       <xs:choice>
>          <xs:sequence>
>              <xs:element name="a" type="xs:string"/>
>              <xs:element name="b" type="xs:string"
maxOccurs="unbounded"/>
>              <xs:element name="c" type="xs:string"/>
>          </xs:sequence>
>          <xs:sequence>
>             <xs:element name="b" type="xs:string"
maxOccurs="unbounded"/>
>             <xs:element name="a" type="xs:string"/>
>             <xs:element name="c" type="xs:string"/>
>          </xs:sequence>
>          <xs:sequence>
>             <xs:element name="a" type="xs:string"/>
>             <xs:element name="c" type="xs:string"/>
>             <xs:element name="b" type="xs:string"
maxOccurs="unbounded"/>
>          </xs:sequence>
>          <xs:sequence>
>             <xs:element name="c" type="xs:string"/>
>             <xs:element name="a" type="xs:string"/>
>             <xs:element name="b" type="xs:string"
maxOccurs="unbounded"/>
>          </xs:sequence>
>          <xs:sequence>
>             <xs:element name="b" type="xs:string"
maxOccurs="unbounded"/>
>             <xs:element name="c" type="xs:string"/>
>             <xs:element name="a" type="xs:string"/>
>          </xs:sequence>
>          <xs:sequence>
>             <xs:element name="c" type="xs:string"/>
>             <xs:element name="b" type="xs:string"
maxOccurs="unbounded"/>
>             <xs:element name="a" type="xs:string"/>
>           </xs:sequence>
>        </xs:choice>
>   </xs:complexType>
> </xs:element>
> 
> I am curious, is the validation happening correctly(for the case a, b,
> c), or is this bug in the validator?
> 
> Regards,
> Mukul
> 
> 
> On 2/18/06, Ramkumar Menon <ramkumar.menon@g...> wrote:
> > Hi,
> >
> > is it possible to ignore the document order while using schema
validator
> to
> > validate an XSD ?
> > If not, is there an alternative to the following issue ?
> > I have an element that has a set of elements witihn it, one of them
> being
> > maxOccurs="unbounded". Since I wanted to use the "xsd:all" group =
so
that
> I
> > can assume unordered child nodes, the node with
maxOccurs="unbounded"
> > prevents me from making such a definition.
> >
> > Any help will be appreciated.
> > pls reply direcly to my email id, since I am not on this mailing
list.
> >
> > rgds,
> > Ram
> >
> > --
> > Shift to the left, shift to the right!
> > Pop up, push down, byte, byte, byte!
> >
> > -Ramkumar Menon
> > A typical Macroprocessor
> 


From mike@s... Sun Feb 19 12:53:25 2006
Received: from lisa.w3.org ([128.30.52.41])
	by frink.w3.org with esmtp (Exim 4.50)
	id 1FAo45-0008Pv-BV
	for xmlschema-dev@l...


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent