Looking for background on XSD cross-referencing mechanisms

Some of you may recall that I'm working on my own simple schema language 
[1].  As part of that I've developed a simple element cross-referencing 
mechanism that is facet based.  I'm wondering whether this was ever 
considered for XSD and if not, are there issues with the mechanism.



To explain the mechanism further, rather than say a type is an id or idRef, 
I've added the equivalent of facets to indicate this.  Translating the 
mechanism into XSD syntax it would look something like:



    <xs:simpleType name="authorId">

        <xs:restriction base="xs:unsignedLong">

            <xs:id value="author"/>

        </xs:restriction>

    </xs:simpleType>



    <xs:simpleType name="authorRef">

        <xs:restriction base="xs:unsignedLong">

            <xs:idRef value="author"/>

        </xs:restriction>

    </xs:simpleType>



    <xs:simpleType name="bookId">

        <xs:restriction base="xs:unsignedLong">

            <xs:id value="book"/>

        </xs:restriction>

    </xs:simpleType>



    <xs:simpleType name="bookRef">

        <xs:restriction base="xs:unsignedLong">

            <xs:idRef value="book"/>

        </xs:restriction>

    </xs:simpleType>



Here the xs:id and xs:idRef facets are new and indicate that the value is 
either an identifier or a reference to an identifier.



The value attribute of the xs:id and xs:idRef facets associates the 
identities and references into named groups such that within each named 
group all identifiers must be unique.  Thus you can have multiple sets of 
cross-references within the same document.



To me the mechanism fixes the problem with DTD's ID/IDREFs so that you can 
have multiple cross-referencing, but is a lot simpler to understand than the 
xs:key/xs:keyRef mechanism.



So I'm wondering if such a mechanism was considered in XSD, and if so why it 
was discarded.  I would like to know if I've missed something.



[1] Annotated XML Example: http://codalogic.com/axe (Work in progress!)


Thanks,


Pete Cordell
Codalogic Ltd
Interface XML to C++ the easy way using C++ XML
data binding to convert XSD schemas to C++ classes.
Visit http://codalogic.com/lmx/ or http://www.xml2cpp.com
for more info
Twitter: http://twitter.com/petecordell

Received on Wednesday, 11 May 2011 09:25:51 UTC