[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
xsd integer enumeration

Hi Xan,

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

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 
something.
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 
value.

Happy New Year!
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


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 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.