[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Non-deterministic content model

  • From: Francis Norton <francis@r...>
  • To: Jeni Tennison <mail@j...>
  • Date: Fri, 15 Jun 2001 14:08:18 +0100

black xs 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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.