I've just use XML::Compile::Schema in my code and found it can not validate
xs:ID restriction.
I have following definition in my XSD:
<xs:element name="name">
<xs:simpleType>
<xs:restriction base="xs:ID">
<xs:pattern value="[a-zA-Z_][a-zA-Z_0-9]*"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
'name' element can occur multiple times in instance XML files. I want every
name to be unique, so "xs:ID" restriction is used.
But when I use same names in one XML file, XML::Compile::Schema can read XML
file smoothly and produce resulting HASH without error. But if I use name
violating pattern rule, error is reported. Does XML::Compile::Schema
implement xs:ID validation? If not, is there any existing work-around?
Following is the perl code I used in testing:
# get schema from file
my $schema = XML::Compile::Schema->new('my.shcema.xsd');
# create and use a reader
use XML::Compile::Util qw/pack_type/;
my $elem = pack_type '', 'my.root.element';
my $read = $schema->compile(READER => $elem);
my $data = $read->("inst.xml");
Thanks!
Iamsolo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/xml-compile/attachments/20080515/f9a6fc7b/attachment.htm
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/xml-compile/attachments/20080515/f9a6fc7b/attachment.htm
