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 <<a href="mailto:mark@overmeer.net">mark@overmeer.net</a>> 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">> As defined in spec, xs:ID restriction is used to guarantee the uniqueness of<br>
> 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. 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. The xs:ID must<br>
be unique. But, you can have extensions to that ID type: are they<br>
seperate ID spaces or the same? 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>
<attribute name="first" type="xs:ID" /><br>
<attribute name="second" type="xs:ID" /><br>
<br>
<simpleType name="personnel-number"><br>
<extension base="xs:ID" /><br>
</simpleType><br>
<attribute name="third" type="xs:personnel-number" /><br>
<br>
If I read the specs well, they are one. People may get big surprises<br>
with name-clashes between ID types. 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. 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>
my $r = $reader->($xml);<br>
has no space for this extension... probably something like this:<br>
<br>
my %ids;<br>
my $reader = $schemas->compile(READER => $type, ids => \%ids);<br>
<br>
while(1)<br>
{ %ids = ();<br>
$reader->($data)<br>
}<br>
<br>
But I am not sure yet, because there also is a<br>
$xml->getElementById('myid');<br>
<br>
So... still needs some thoughts.<br>
<font color="#888888">--<br>
Regards,<br>
</font><div><div></div><div class="Wj3C7c"><br>
MarkOv<br>
<br>
------------------------------------------------------------------------<br>
Mark Overmeer MSc MARKOV Solutions<br>
Mark@Overmeer.net <a href="mailto:solutions@overmeer.net">solutions@overmeer.net</a><br>
<a href="http://Mark.Overmeer.net" target="_blank">http://Mark.Overmeer.net</a> <a href="http://solutions.overmeer.net" target="_blank">http://solutions.overmeer.net</a><br>
<br>
</div></div></blockquote></div><br>