Subject: | Bug in XML-Validator-Schema v1.10 |
Date: | Mon, 24 Nov 2008 09:06:57 +0000 |
To: | bug-XML-Validator-Schema [...] rt.cpan.org |
From: | oliver.critchley [...] etas.com |
Hi,
I think there is a bug in the implementation of "union" elements in
XML-Validator-Schema v1.10. I am using Perl v5.8.8 on Windows XP.
As an example of the problem, suppose I want to define a simpleType called
"dword" which can contain either a hex or a decimal representation of a
32-bit value:
<xsd:simpleType name="hexDword">
<xsd:restriction base="xsd:string">
<xsd:pattern value="0x([a-f]|[A-F]|[0-9]){1,8}"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="dword">
<xsd:union memberTypes="xsd:unsignedInt hexDword"/>
</xsd:simpleType>
<!-- And later on we refer to the type... -->
<xsd:element name="My32bitElement" type="dword" />
When I try to validate a document against this schema I get the error
"Element '<My32bitElement>' has unrecognized type 'dword'". If I rewrite
the schema to define the union inline within the element everything is OK
and the document validates successfully:
<xsd:element name="My32bitElement">
<xsd:simpleType>
<xsd:union memberTypes="xsd:unsignedInt hexDword"/>
</xsd:simpleType>
</xsd:element>
Despite this, XML-Validator-Schema is still a useful little bit of
software - thanks for making my life easier!
Oliver