RE: keyrefs from list type (ala IDREFS)

Michael's answer is correct as far as I know.  Perhaps a little bit of 
perspective might be useful:

The purpose of XML is in some sense to give a standard means of marking up 
structured information so you can process it.  Of course, that markup can 
be a bit heavyweight, and there are temptations sometimes not to use 
explicit markup.  Compare for example:

        <width>5 inches</width>
        <width units="inches">5</width>

Clearly, the former is more compact and easier to author;  the latter is 
much more robust, particularly for processing with XML-based tools.

Lists raise some similar issues:

        <partNumbers>123  876 524</partNumbers>

        <partNumbers>
                <partNumber>123</partNumber>
                <partNumber>876</partNumber>
                <partNumber>524</partNumber>
        </partNumbers>

Given that people will use both forms, it is tempting to reinvent all the 
mechanisms of XML validation, transform, pattern matching, or in this case 
key matching for the compact forms.  The XML Schema WG considered these 
tradeoffs in detail years ago.  I think it's fair to say that most members 
felt that building such duplicate mechanisms was for the most part the 
wrong way to go.  If you need rich facilities for structured data 
processing, use XML markup.  If you want the convenience of compact forms, 
then don't expect XML to help you with more than the basics.  As an 
accomodation to the fact that there will sometimes be reason for having 
structured simple types, we've included a limited suite of facilities 
including list types, pattern facets, etc.  In fact, some members were 
against doing that much, in part because doing so would raise expectations 
for yet richer support. 

Anyway, I would not expect XML Schema to grow into a robust processing 
language for structured simple types, at least not in the forseeable 
future.  I hope this explains the tradeoffs that were might in designing 
the support that's provided for list types in XML Schema 1.0.

Noah

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------








"Michael Kay" <mike@saxonica.com>
Sent by: xmlschema-dev-request@w3.org
04/14/2006 03:36 AM
 
        To:     "'Gavin Kistner'" <gavin.kistner@anark.com>, 
<xmlschema-dev@w3.org>
        cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        RE: keyrefs from list type (ala IDREFS)


No, I believe that when a list-valued item is selected by an identity 
constraint, it is treated as a single value.
 
Michael Kay
http://www.saxonica.com/

From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] 
On Behalf Of Gavin Kistner
Sent: 13 April 2006 20:23
To: xmlschema-dev@w3.org
Subject: keyrefs from list type (ala IDREFS)

Is it possible to apply keyref constraints to each item in a list 
attribute? For example:
 
<root>
    <item id="1" />
    <item id="2" />
    <aggregate items="1 2" />
</root>
...
<xsd:unique name="unique-ids">
    <xsd:selector xpath="./item" /> 
    <xsd:selector xpath="@id" />
</xsd>
...
<xsd:attribute name="items" use="required">
    <xsd:simpleType>
        <xsd:list itemType="xsd:nonNegativeInteger" />
    </xsd:simpleType>
</xsd:attribute>
 
In the above example, ID and IDREFS would do what I want, but in my 
particular application, I need more granular control over the scope. Is 
there a way to use the above schema and apply a constraint, ensuring that 
the ids listed in items correspond to valid 'id's?
 
My apologies if this is a FAQ. I searched the list archive (and web), and 
I could only find one question related to this (with no responses) and a 
second response which maybe indicated that it's not possible.
 
Thanks in advance for any help (and sorry about the bloated corporate 
..sig),
Gavin Kistner
Product Designer
Anark Corporation
1434 Spruce Street, Suite 200
Boulder, Colorado 80302 
[P] 303-545-2592, x256
[F] 303-545-2575
gavin.kistner@anark.com
http://www.anark.com
Revolutionize Communication with Interactive 3D 
This electronic message is intended to be viewed only by the individual or 
entity to whom it is addressed. It may contain information that is 
privileged, confidential and exempt from disclosure under applicable law. 
Any dissemination, distribution or copying of this communication is 
strictly prohibited without our prior permission. If the reader of this 
message is not the intended recipient please notify us immediately by 
return e-mail and delete the original message and any copies of it from 
your computer system.
 

Received on Sunday, 16 April 2006 13:19:22 UTC