W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2004

Re: Handling the enumeration facet

From: Klaas Dellschaft <klaasd@uni-koblenz.de>
Date: Thu, 30 Dec 2004 22:38:57 +0100
Message-ID: <005001c4eeb7$f92c1c60$c301a8c0@MorningSun>
To: "Michael Kay" <mike@saxonica.com>, <xmlschema-dev@w3.org>

> I think the value given in the value attribute of xs:enumeration is 
> treated
> as if it were an instance of the relevant data type appearing in an 
> instance
> document. That means, in this case, that 10 is treated as an xs:integer,
> because that's the first thing in the list of member types that it 
> matches.

But you can change the sequence of evaluation in an instance document with 
the attribute xsi:type. So if we take my previous example and add an element 
declaration:

<xs:element name="test">
    <xs:simpleType>
        <xs:restriction>
            <xs:union memberTypes="xs:integer xs:string"/>
            <xs:enumeration value="10"/>
        </xs:restriction>
    </xs:simpleType>
</xs:element>


What you said would mean that the following should be rejected by a parser:

<test xsi:type="xs:integer">10</test>

I'm asking these questions because I'm using two tools which handle this 
differently and I'm not sure whether the possible change of evaluation order 
should also be reflected by interpreting the literal of an enumeration. This 
would require that the value space does not only contain the number 10 but 
also the string "10". What do you think?


Klaas Dellschaft 
Received on Thursday, 30 December 2004 21:39:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:48 GMT