Skip Menu |

This queue is for tickets about the XML-Validator-Schema CPAN distribution.

Report information
The Basics
Id: 6535
Status: resolved
Priority: 0/
Queue: XML-Validator-Schema

People
Owner: Nobody in particular
Requestors: luke [...] orchardsolutions.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.06
Fixed in: (no value)



Subject: Erroneous validation of enumeration elements
Using the xml and schema below, and XML::Validator::Schema as demonstrated, an error should be generated, since the country name is not in the enumeration list. Instead, the xml validates. XML: <?xml version="1.0" encoding="utf-8"?> <country name="bar" /> Schema: <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified"> <xs:element name="country" type="countryType" /> <xs:complexType name="countryType"> <xs:attribute name="name" type="countryNameType" use="required"/> </xs:complexType> <xs:simpleType name="countryNameType"> <xs:restriction base="xs:string"> <xs:enumeration value="foo"/> </xs:restriction> </xs:simpleType> </xs:schema> Perl: #!/usr/bin/perl -w use strict; use XML::Validator::Schema; use XML::SAX::ParserFactory; # create a new validator object, using test.xsd my $validator = XML::Validator::Schema->new(file => 'test.xsd'); # create a SAX parser and assign the validator as a Handler my $parser = XML::SAX::ParserFactory->parser(Handler => $validator); # validate test.xml against test.xsd eval { $parser->parse_uri(test.xml) }; die "File failed validation: $@" if $@; print "OK\n";
This is fixed for 1.07. Thanks for the report!