incorrect schema validation with xsv - bugs?

> hi,
> 
> i installed xsv 2.0-3 locally on my machine from the web page http://www.ltg.ed.ac.uk/~ht/xsv-status.html
> 
> i'm working through Roger Costello's xml schema tutorial.
> 
> i'm observing some behavior (see below) which i think is not correct. since i'm a new user of xml schema's, i might be mistaken, in which case i'd be happy to be corrected.
> 
> the schema and xml-file are attached.
> 
> thanks, Claudia Betz-Haubold
> 
> >  <<juicers.xml>> > >  <<juicers.xsd>> 
> I) validation doesn't work correctly if you restrict a decimal with respect to fractionDigits
> 
> declaring the following type in the schema
> 
>     <xsd:simpleType name="money">
>         <xsd:restriction base="xsd:decimal">
>             <xsd:fractionDigits value="2"/>
>         </xsd:restriction>
>     </xsd:simpleType>
> 
> does not result in a validation error if the instance document contains the following entry:
> 
>       <juicer id="mighty-oj" electric="false" type="press">
>           <description>....</description>
>           <guarantee>lifetime warranty</guarantee>
>           <name>OJ Home Juicer</name>
>           <image>images\mighty_oj.gif</image>
>           <cost currency="USD">41.955</cost>
>           <retailer>http://www.thewhitewhale.com/oj.htm</retailer>
>       </juicer>
> 
> validation does not return an error, even if the number of digits is not 2
> 
> 
> 
> 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.

Received on Wednesday, 20 November 2002 14:27:54 UTC