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

RE: embedded space

From: Biron,Paul V <Paul.V.Biron@kp.org>
Date: Wed, 6 Dec 2000 12:16:20 -0800
Message-Id: <376E771642C1D2118DC300805FEAAF43014BA838@pars-exch-1.ca.kp.org>
To: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
Cc: "'Andy Palmer'" <Andy.Palmer@mediasurface.com>
> -----Original Message-----
> From:	Andy Palmer [SMTP:Andy.Palmer@mediasurface.com]
> Sent:	Wednesday, December 06, 2000 6:56 AM
> To:	'www-xml-schema-comments@w3.org'
> Cc:	'marting@develop.com'
> Subject:	Re: embedded space
> 
See below...

> 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.
> 
One thing, which I'm not sure whether it was in your original document or
was something that my mailer added, is that you have attribute values that
directly have "<" rather than &lt; or &#x3c; in both your instance document
and the schema document, and hence, neither is well-formed.  That is,
everywhere you have uriReference's they are enclosed in angle brackets and
they shouldn't be.  However, once those are removed, you are doing nothing
wrong.

Assuming it was NOT my mailer that added the angle brackets to your
uriReferences (since it's never done that to any other xml instances that in
messages), I don't know whether the well-formedness errors were confusing
XMLSpy or not.  But with the correction, the instance you give above should
validate, and does so with XSV (the only tool I have easily available at the
moment).

pvb
Received on Wednesday, 6 December 2000 15:40:45 GMT

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