Re: Enumeration facet - List Datatype

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 UTC