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

Re: Enumeration facet - List Datatype

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 06 Dec 2000 21:09:13 +0000
To: Elena Litani <hlitani@jtcsv.com>
Cc: xmlschema-dev@w3.org
Message-ID: <f5bpuj55kau.fsf@cogsci.ed.ac.uk>
Elena Litani <hlitani@jtcsv.com> writes:

> I am confused about enumeration facet on list datatype.
> 
> Which case is correct?
> (1) The enumeration is a constraint on the list 
> OR 
> (2) The enumeration is constraint on elements of the list.
> 
> 
> For example, lets say I have the following schema:

> <?xml version="1.0" encoding="UTF-8"?>
> <schema>
> <element name ="myInt" type="myType"/>
> <simpleType name="myList">  
> 	<list itemType="integer"/>
> </simpleType>
> 
> <simpleType name="myType">
>  <restriction base="myList">
>     <enumeration value="1"/>
>     <enumeration value="2"/>
>   </restriction>
> </simpleType>
> </schema>   
> 
> In the corresponding, xml document:
> 
> <myInt>1 2</myInt>
> 
> would it be Valid or Invalid?

Invalid.  You've constrained the list.  To constrain the elements, do

<xs:simpleType name="myList">
 <xs:list>
  <xs:simpleType>
   <xs:restriction base="xs:integer">
    <xs:enumeration value="1"/>
    <xs:enumeration value="2"/>
   </xs:restriction>
  </xs:simpleType>
 </xs:list>
</xs:simpleType>

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
Received on Wednesday, 6 December 2000 16:09:18 GMT

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