Permit (greedy) conflicting wildcards

Just reading David Orchard's document "Guide to Versioning XML Languages
using XML Schema 1.1"
(http://www.w3.org/TR/2006/WD-xmlschema-guide2versioning-20060928/).

It says that under the current interpretation of XSD 1.1 the following 
(slightly simplified from David's document) is illegal due to the 
minOccurs="0" of middle name allowing the two adjacent wildcards to 
conflict:

    <xs:sequence>
      <xs:element name="given" type="xs:string"/>
      <xs:any namespace="##any" processContents="lax"
              minOccurs="0" maxOccurs="unbounded"/>
      <xs:element name="middle" type="xs:string" minOccurs="0"/>
      <xs:any namespace="##any" processContents="lax"
              minOccurs="0" maxOccurs="unbounded"/>
      <xs:element name="family" type="xs:string"/>
    </xs:sequence>

It then says that new wording in XSD1.1 has been added to make the following
legal:

    <xs:sequence>
      <xs:element name="given" type="xs:string"/>
      <xs:any namespace="##any" processContents="lax"
              minOccurs="0" maxOccurs="unbounded"/>
      <xs:sequence minOccurs="0">
          <xs:element name="middle" type="xs:string" />
          <xs:any namespace="##any" processContents="lax"
                minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:element name="family" type="xs:string"/>
    </xs:sequence>

Replacing the xs:anys with xs:element declarations, UPAC wise I don't
think the following would be legal:

    <xs:sequence>
      <xs:element name="given" type="xs:string"/>
      <xs:element name="any" minOccurs="0" maxOccurs="unbounded"/>
      <xs:sequence minOccurs="0">
          <xs:element name="middle" type="xs:string" />
          <xs:element name="any" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:element name="family" type="xs:string"/>
    </xs:sequence>

So I don't see why the second example should be considered anymore
intrinsically legitimate than the first example.

As the second example seems a bit of a fudge, and is non-intuitive and
messy, I propose that the rules be changed to make the first example legal.
Basically a wild card should be allowed to be greedy and gobble up anything
until it encounters something that does match the wild card spec, or is an
immediately accessible element name on the path following the wildcard.

I would even say, if someone wants to do:

    <xs:sequence>
      <xs:any namespace="##any" processContents="lax"
              minOccurs="0" maxOccurs="unbounded"/>
      <xs:any namespace="##any" processContents="lax"
              minOccurs="0" maxOccurs="unbounded"/>
      <xs:any namespace="##any" processContents="lax"
              minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>

they should be allowed to do it and it wouldn't be an error.  Although
helpful tools might care to issue a warning that they're wasting their time!

Cheers,

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx/
http://www.codalogic.com/lmx/
=============================================

Received on Thursday, 15 March 2007 14:57:09 UTC