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

Re: incorrect schema validation with xsv - bugs?

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 25 Nov 2002 15:07:33 +0000
To: "Claudia Betz-Haubold" <cbetz@skyva.com>
Cc: <xmlschema-dev@w3.org>
Message-ID: <f5bvg2ladsa.fsf@erasmus.inf.ed.ac.uk>

"Claudia Betz-Haubold" <cbetz@skyva.com> writes:

> > II) validation doesn't work correctly if you use default/fixed on an attribute but the value entered does not match the type:
> > 
> > example 1)
> > 
> >                     <xsd:element name="weight" minOccurs="0">
> >                         <xsd:complexType>
> >                             <xsd:simpleContent>
> >                                 <xsd:extension base="xsd:positiveInteger">
> >                                     <xsd:attribute name="units" type="weightUnit" default="pound"/>
> >                                 </xsd:extension>
> >                             </xsd:simpleContent>
> >                         </xsd:complexType>
> >                     </xsd:element>
> > 
> >     <xsd:simpleType name="weightUnit">
> >         <xsd:restriction base="xsd:string">
> >             <xsd:enumeration value="pounds"/>
> >             <xsd:enumeration value="kilograms"/>
> >         </xsd:restriction>
> >     </xsd:simpleType>
> > 
> > the schema validation returns no errors, and the xml validates as long as you enter nothing or pounds or kilogram. but if you enter pound (the declared default value), you get an error.
> > 
> > example 2)
> > 
> >                     <xsd:element name="weight" minOccurs="0">
> >                         <xsd:complexType>
> >                             <xsd:simpleContent>
> >                                 <xsd:extension base="xsd:positiveInteger">
> >                                     <xsd:attribute name="units" type="xsd:integer" fixed="pound"/>
> >                                 </xsd:extension>
> >                             </xsd:simpleContent>
> >                         </xsd:complexType>
> >                     </xsd:element>
> > 
> > the schema validation returns no errors, and the xml validates, as long as you do not enter any value for units.

These bugs are now caught by XSV.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2002, 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/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]
Received on Monday, 25 November 2002 10:07:37 GMT

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