Hi, all, <br><br>I&#39;ve just use XML::Compile::Schema in my code and found it can not validate xs:ID restriction. <br><br>I have following definition in my XSD:<br><br><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; &lt;xs:element name=&quot;name&quot;&gt;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xs:simpleType&gt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xs:restriction base=&quot;xs:ID&quot;&gt;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xs:pattern value=&quot;[a-zA-Z_][a-zA-Z_0-9]*&quot;/&gt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xs:restriction&gt;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xs:simpleType&gt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; &lt;/xs:element&gt;<br><br><span style="font-family: arial,sans-serif;">&#39;name&#39; element can occur multiple times in instance XML files. I want every name to be unique, so &quot;xs:ID&quot; restriction is used.<br>
But when I </span></span>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,&nbsp; error is reported. Does XML::Compile::Schema implement xs:ID validation? If not, is there any existing work-around? <br>
<br>Following is the perl code I used in testing:<br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"># get schema from file</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">my $schema = XML::Compile::Schema-&gt;new(&#39;my.shcema.xsd&#39;);</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"># create and use a reader</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">use XML::Compile::Util qw/pack_type/;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">my $elem&nbsp;&nbsp; = pack_type &#39;&#39;, &#39;my.root.element&#39;; </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">my $read&nbsp;&nbsp; = $schema-&gt;compile(READER =&gt; $elem);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">my $data&nbsp;&nbsp; = $read-&gt;(&quot;inst.xml&quot;);</span><br>
<br><br>Thanks!<br><br>Iamsolo<br><br>