W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2000

Re: embedded space

From: Andy Palmer <Andy.Palmer@mediasurface.com>
Date: Wed, 6 Dec 2000 14:55:40 -0000
Message-ID: <02F5D2F056BDD411B3CE0004AC96F8A3224011@ntexchange.int.mediasurface.com>
To: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
Cc: "'marting@develop.com'" <marting@develop.com>
Sorry for coming in on this late, but I can't get (a variant of) the example
to work. The xml is:

<?xml version="1.0"?>
<Tester colour="dark red"
              xmlns:xsi="http://www.w3.org/2000/10/XMLSchema"
              xsi:noNamespaceSchemaLocation="D:\andyp\xml\tester.xsd">

 <dummy>hello world</dummy>

</Tester>


The xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">

 <xsd:simpleType name="colours">
  <xsd:restriction base="xsd:string">
   <xsd:enumeration value="red"/>
   <xsd:enumeration value="dark red"/>
  </xsd:restriction>
 </xsd:simpleType>

 <xsd:element name="Tester">
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element name="dummy" type="xsd:string"/>
   </xsd:sequence>
   <xsd:attribute name="colour" type="colours"/>
   <xsd:attribute name="xsi:schemaLocation" type="xsd:string"/>
   <xsd:attribute name="xmlns:xsi" use="default"
value="http://www.w3.org/2000/10/XMLSchema" type="xsd:uriReference"/>
   <xsd:attribute name="xsi:noNamespaceSchemaLocation" type="xsd:string"/>
  </xsd:complexType>
 </xsd:element>

</xsd:schema>


Using XMLSpy 3.5b1 the xsd is fine, but the xml gives the error (on line 2):

"Unexpected choice 'dark red' for attribute 'colour': (red|dark|red)
expected.

What am I doing wrong (I've included everything in case I've missed
something blindingly obvious)? There's not much about this topic on the web,
but there must be loads of uses - my need is actually to limit an element to
a set of names, and that must be quite common.
Received on Wednesday, 6 December 2000 09:59:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:49 GMT