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

Re: Handling the enumeration facet

From: George Cristian Bina <george@oxygenxml.com>
Date: Fri, 31 Dec 2004 12:34:57 +0200
Message-ID: <41D52B51.1010604@oxygenxml.com>
To: Xan Gregg <xan.gregg@jmp.com>
Cc: xmlschema-dev@w3.org, klaasd@uni-koblenz.de

Hi Xan,

As I read the specification there is nothing that makes
<test xsi:type="xs:string">10</test>

FWIW Xerces reports this as valid, it allows both the integer and the 
string value.

The member types order is significant for validation, but it defines 
only a default, one can specify with xsi:type the specific type. The 
value space is a set of values and I do not find a distinction between 
string 10 and integer 10 in the value space. Let me know if I'm missing 
More, the enumeration value is defined as anySimpleType for which the 
value space is defined as:
ˇvalue spaceˇ consisting of the union of the ˇvalue spaceˇs of all the 
ˇprimitiveˇ datatypes and the set of all lists of all members of the 
ˇvalue spaceˇs of all the ˇprimitiveˇ datatypes.
Now the string type is the first defined primitive datatype, so one can 
very well consider 10 to be a string rather than an integer.

I will go for Xerces approach to allow both the string and the integer 

Happy New Year!
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger

Xan Gregg wrote:
> The example is not valid.  The enumeration needs to be done in a 
> separate step, as follows:
>   <xsd:simpleType name="s1">
>     <xsd:union memberTypes="xsd:integer xsd:string"/>
>   </xsd:simpleType>
>   <xsd:simpleType name="s2">
>     <xsd:restriction base="s1">
>       <xsd:enumeration value="10"/>
>     </xsd:restriction>
>   </xsd:simpleType>
> Now it's more clear that the value space has only the integer 10, since 
> the lexical value "10" corresponds to the integer 10 in s1.
>> But you can change the sequence of evaluation in an instance document 
>> with
>> the attribute xsi:type.
> If test is declared to have type s2, I would expect:
> <test xsi:type="xs:integer">10</test>  <!-- valid -->
> <test xsi:type="xs:string">10</test>  <!-- invalid -->
> xan
Received on Friday, 31 December 2004 10:30:19 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:07 UTC