[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Non-deterministic content model
Jeni Tennison wrote: > > RELAX NG doesn't require deterministic patterns; the following > schema should do it: > <snip/> Yes, I got this to work with James Clark's jing (http://www.thaiopensource.com/relaxng/): <grammar xmlns="http://relaxng.org/ns/structure/0.9"> <start> <element name="game"> <element name="white"> <ref name="move"/> </element> <zeroOrMore> <element name="black"> <ref name="move"/> </element> <element name="white"> <ref name="move"/> </element> </zeroOrMore> <optional> <element name="black"> <ref name="move"/> </element> </optional> </element> </start> <define name="move"> <text/> </define> </grammar> The grammar expanded a bit because you can't simply say <element name="white/>, you have to put in some kind of content description, even if only <text/> or <empty/>, so I created a common type, move. > XML Schema forces deterministic model groups, so you can't use that. > Interesting. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="game"> <xs:complexType> <xs:sequence> <xs:element ref="white"/> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:element ref="black"/> <xs:element ref="white"/> </xs:sequence> <xs:element ref="black" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="black"> <xs:complexType/> </xs:element> <xs:element name="white"> <xs:complexType/> </xs:element> </xs:schema> is an XML Schema equivalent. XSV and MSXML4 detect the ambiguous content model, XML Spy 4 beta 1 ignores it and validates correctly. Francis.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|