W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2002

list of union-types - simple problem?

From: <Simon.Cox@csiro.au>
Date: Fri, 25 Jan 2002 19:37:11 +0800
Message-ID: <116D27C8E12BD411B3AB00B0D022B0B8AF093D@yate.wa.csiro.au>
To: xmlschema-dev@w3.org
Cc: support@xmlspy.com
I'm having a problem with a list type whose items are a union.  
Here's a test schema: 

<xs:schema targetNamespace="http://www.ned.dem.csiro.au/XMML"
xmlns:xmml="http://www.ned.dem.csiro.au/XMML"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
  <!-- enumerated simpleType -->
  <xs:simpleType name="NullType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="inapplicable"/>
      <xs:enumeration value="unknown"/>
      <xs:enumeration value="unavailable"/>
      <xs:enumeration value="missing"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- union simpleType -->
  <xs:simpleType name="doubleOrNull">
    <xs:union memberTypes="xmml:NullType xs:double"/>
  </xs:simpleType>
  <!-- list simpleType -->
  <xs:simpleType name="QuantityListType">
    <xs:list itemType="xmml:doubleOrNull"/>
  </xs:simpleType>
  <!-- element -->
  <xs:element name="quantityList" type="xmml:QuantityListType"/>
</xs:schema>

and here's a simple instance:

<quantityList xmlns="http://www.ned.dem.csiro.au/XMML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ned.dem.csiro.au/XMML ./listTest.xsd">0.86
0.86 missing</quantityList>

Spy says "Invalid value for datatype list of union of string, double in
element 'quantityList'".  

Why invalid??

_____
Simon.Cox@csiro.au  CSIRO Exploration & Mining
26 Dick Perry Avenue, Kensington WA 6151
PO Box 1130, Bentley WA 6102  AUSTRALIA
T: +61 (8) 6436 8639  F: +61 (8) 6436 8555  C: +61 (4) 0330 2672
http://www.csiro.au/page.asp?type=resume&id=CoxSimon
Received on Friday, 25 January 2002 06:44:55 GMT

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