Based on my understanding, xs:ID is global in one XML file. So all elements constricts by xs:ID share one name space. <br><br>I really underestimate the difficulties of checking implementation, it is not as simple as my thought...<br>
<br><div class="gmail_quote">On Sun, May 18, 2008 at 6:43 PM, Mark Overmeer &lt;<a href="mailto:mark@overmeer.net">mark@overmeer.net</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
* MENG Xin (<a href="mailto:zinces@gmail.com">zinces@gmail.com</a>) [080518 04:49]:<br>
<div class="Ih2E3d">&gt; As defined in spec, xs:ID restriction is used to guarantee the uniqueness of<br>
&gt; contents. The question is who guarantee the uniqueness, users or tools?<br>
<br>
</div>Daniel showed in a follow-up that validating schema handlers shall check<br>
the uniqueless. &nbsp;XML::Compile is validating on the messages by default,<br>
so should check it and die on collissions.<br>
<br>
A question which I still have is: define uniqueless. &nbsp;The xs:ID must<br>
be unique. &nbsp;But, you can have extensions to that ID type: are they<br>
seperate ID spaces or the same? &nbsp;And is xml:ID, schema-1999:ID<br>
and schema-2001:ID one and the same space?</blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
 &nbsp;&lt;attribute name=&quot;first&quot; &nbsp;type=&quot;xs:ID&quot; /&gt;<br>
 &nbsp;&lt;attribute name=&quot;second&quot; type=&quot;xs:ID&quot; /&gt;<br>
<br>
 &nbsp;&lt;simpleType name=&quot;personnel-number&quot;&gt;<br>
 &nbsp; &nbsp;&lt;extension base=&quot;xs:ID&quot; /&gt;<br>
 &nbsp;&lt;/simpleType&gt;<br>
 &nbsp;&lt;attribute name=&quot;third&quot; &nbsp;type=&quot;xs:personnel-number&quot; /&gt;<br>
<br>
If I read the specs well, they are one. &nbsp;People may get big surprises<br>
with name-clashes between ID types. &nbsp;Or should I create an option?<br>
That would complicate things a lot.<br>
<br>
Another thing what worries me, is that I probably need to run-time<br>
check each element whether is has an ID attribute, which can be<br>
costly. &nbsp;I hope XML::LibXML can help me in some way.<br>
<br>
The last problem to solve, is how to return the id index (because<br>
if you keep it, you probably should give people access to it as well).<br>
 &nbsp;my $r = $reader-&gt;($xml);<br>
has no space for this extension... probably something like this:<br>
<br>
 &nbsp;my %ids;<br>
 &nbsp;my $reader = $schemas-&gt;compile(READER =&gt; $type, ids =&gt; \%ids);<br>
<br>
 &nbsp;while(1)<br>
 &nbsp;{ &nbsp; %ids = ();<br>
 &nbsp; &nbsp; &nbsp;$reader-&gt;($data)<br>
 &nbsp;}<br>
<br>
But I am not sure yet, because there also is a<br>
 &nbsp;$xml-&gt;getElementById(&#39;myid&#39;);<br>
<br>
So... still needs some thoughts.<br>
<font color="#888888">--<br>
Regards,<br>
</font><div><div></div><div class="Wj3C7c"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MarkOv<br>
<br>
------------------------------------------------------------------------<br>
 &nbsp; &nbsp; &nbsp; Mark Overmeer MSc &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MARKOV Solutions<br>
 &nbsp; &nbsp; &nbsp; Mark@Overmeer.net &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="mailto:solutions@overmeer.net">solutions@overmeer.net</a><br>
<a href="http://Mark.Overmeer.net" target="_blank">http://Mark.Overmeer.net</a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://solutions.overmeer.net" target="_blank">http://solutions.overmeer.net</a><br>
<br>
</div></div></blockquote></div><br>