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

Re: XML schema cos-nonambig problem


xml schema xs sequence
>    <define name="contentiddef">
>      <choice>
>        <interleave>
>          <optional>
>            <element name="major" ns="http://www.polopoly.com/polopoly/
> cm/app/xml">
>              <choice>
>                <text/>
>                <data type="integer"/>
>              </choice>
>            </element>
>          </optional>
>          <element name="externalid" ns="http://www.polopoly.com/
> polopoly/cm/app/xml">
>            <text/>
>          </element>
>        </interleave>
>        <interleave>
>          <element name="major" ns="http://www.polopoly.com/polopoly/
> cm/app/xml">
>            <choice>
>              <text/>
>              <data type="integer"/>
>            </choice>
>          </element>
>          <element name="minor" ns="http://www.polopoly.com/polopoly/
> cm/app/xml">
>            <data type="nonNegativeInteger"/>
>          </element>
>          <optional>
>            <element name="version" ns="http://www.polopoly.com/
> polopoly/cm/app/xml">
>              <data type="integer"/>
>            </element>
>          </optional>
>        </interleave>
>      </choice>
>    </define>

OK, let me try...

In short this is

  (ma? & e) | (ma & mi & v?)

This can also be written deterministically as:

  (e ma?) |
  (ma (e | mi v? | v mi)) |
  (mi (ma v? | v ma)) |
  (v (ma mi | mi ma))

In XSD this becomes:

<xs:complexType name="contentiddef">
  <xs:choice>
    <xs:sequence>
      <xs:element ref="x:externalid"/>
      <xs:element ref="x:major" minOccurs="0"/>
    </xs:sequence>
    <xs:sequence>
      <xs:element ref="x:major"/>
      <xs:choice>
        <xs:element ref="x:externalid"/>
        <xs:sequence>
          <xs:element ref="x:minor"/>
          <xs:element ref="x:version" minOccurs="0"/>
        </xs:sequence>
        <xs:sequence>
          <xs:element ref="x:version"/>
          <xs:element ref="x:minor"/>
        </xs:sequence>
      </xs:choice>
    </xs:sequence>
    <xs:sequence>
      <xs:element ref="x:minor"/>
      <xs:choice>
        <xs:sequence>
          <xs:element ref="x:major"/>
          <xs:element ref="x:version" minOccurs="0"/>
        </xs:sequence>
        <xs:sequence>
          <xs:element ref="x:version"/>
          <xs:element ref="x:major"/>
        </xs:sequence>
      </xs:choice>
    </xs:sequence>
    <xs:sequence>
      <xs:element ref="x:version"/>
      <xs:choice>
        <xs:sequence>
          <xs:element ref="x:major"/>
          <xs:element ref="x:minor"/>
        </xs:sequence>
        <xs:sequence>
          <xs:element ref="x:minor"/>
          <xs:element ref="x:major"/>
        </xs:sequence>
      </xs:choice>
    </xs:sequence>
  </xs:choice>
</xs:complexType>

This is actually just building a FSM from the relax schema. I'm not sure
if this can be done for every relax schema. But at least for those schemas
that do have a FSM, it can be done automatically. So there might be a tool
out there that does this. Does anyone know one?

greetings,

--
Sjoerd Visscher
http://w3future.com/weblog/



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.