Subject: | Bug at ErrorReport by validate |
Date: | Sun, 10 Apr 2011 15:53:29 +0200 |
To: | bug-XML-LibXML [...] rt.cpan.org |
From: | McPower <mc-power [...] justmail.de> |
Hello,
the validate Routine has a Problem with/minOccurs="0" //maxOccurs="0"/.
The Error Message is wrong.
The correct Message is /Schemas validity error : Element '{.....}b':
This element is not expected./
It is only a Pointer Error in the library? i+1 ?
XML:
<a>
<b>testA</b>
<c>testB</c>
</a>
XSD:
<xs:complexType name="a">
<xs:element name="b" type="myString100" minOccurs="0"
maxOccurs="0">
</xs:element>
<xs:element name="c" type="mxString100">
</xs:element>
</xs:complexType>
ERROR:
in.xml:0: Schemas validity error : Element '{.....}c': This element is
not expected.
$xml_filename_or_url = "in.xml";
$schema_filename_or_url = "schema.xsd";
use XML::LibXML;
$doc = XML::LibXML->new->parse_file($xml_filename_or_url);
$xmlschema = XML::LibXML::Schema->new( location =>
$schema_filename_or_url );
eval { $xmlschema->validate( $doc ); };
on perl v5.12.3 - winXP
LibXML - 1.70