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

Re: Handling the enumeration facet

From: Xan Gregg <xan.gregg@jmp.com>
Date: Thu, 30 Dec 2004 21:07:01 -0500
Message-Id: <A8834738-5AD0-11D9-B48D-000A95A7F890@jmp.com>
Cc: klaasd@uni-koblenz.de
To: xmlschema-dev@w3.org

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 02:07:09 GMT

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