← Prev in month ← Prev in thread
Next in thread → Next in month →

Determinism as seen by relaxMeter and trang

From
Eric van der Vlist <>
Date
2003-07-05T12:19:20+00:00
ID
Thread
Determinism as seen by relaxMeter and trang
Hi,

Let's consider the following:

grammar{

start = element root{(first?,second)|(second,third?)}

first=element first{empty}
second=element second{empty}
third=element third{empty}

}

This schema is ambiguous because if we validate:

<root><second/></root>

we cannot say which branch of the choice has been used.

However, relaxMeter says "no collision detected" and trang generates a WXS
schema which violates WXS' UPA rule:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">  <xs:element name="root">
    <xs:complexType>
      <xs:choice>
        <xs:sequence>
          <xs:element minOccurs="0" ref="first"/>
          <xs:element ref="second"/>
        </xs:sequence>
        <xs:sequence>
          <xs:element ref="second"/>
          <xs:element minOccurs="0" ref="third"/>
        </xs:sequence>
      </xs:choice>
    </xs:complexType>
  </xs:element>
  <xs:element name="first">
    <xs:complexType/>
  </xs:element>
  <xs:element name="second">
    <xs:complexType/>
  </xs:element>
  <xs:element name="third">
    <xs:complexType/>
  </xs:element>
</xs:schema>

Error message from Xerces:

[Error] cdr4.xsd:2:87: Error: cos-nonambig: (,second) and (,second)
violate the "Unique Particle Attribution" rule.
Is there any way we could help users to fall into this kind of pitfalls?

Thanks

Eric

-- 
Freelance consulting and training.
                                            http://dyomedea.com/english/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------
← Prev in month ← Prev in thread
Next in thread → Next in month →