[Xml-compile] XML::Compile::Schema validation on xs:ID has problem

Mark Overmeer mark at overmeer.net
Sun May 18 11:43:54 BST 2008


* MENG Xin (zinces at gmail.com) [080518 04:49]:
> As defined in spec, xs:ID restriction is used to guarantee the uniqueness of
> contents. The question is who guarantee the uniqueness, users or tools?

Daniel showed in a follow-up that validating schema handlers shall check
the uniqueless.  XML::Compile is validating on the messages by default,
so should check it and die on collissions.

A question which I still have is: define uniqueless.  The xs:ID must
be unique.  But, you can have extensions to that ID type: are they
seperate ID spaces or the same?  And is xml:ID, schema-1999:ID
and schema-2001:ID one and the same space?

  <attribute name="first"  type="xs:ID" />
  <attribute name="second" type="xs:ID" />

  <simpleType name="personnel-number">
    <extension base="xs:ID" />
  </simpleType>
  <attribute name="third"  type="xs:personnel-number" />

If I read the specs well, they are one.  People may get big surprises
with name-clashes between ID types.  Or should I create an option?
That would complicate things a lot.

Another thing what worries me, is that I probably need to run-time
check each element whether is has an ID attribute, which can be
costly.  I hope XML::LibXML can help me in some way.

The last problem to solve, is how to return the id index (because
if you keep it, you probably should give people access to it as well).
  my $r = $reader->($xml);
has no space for this extension... probably something like this:

  my %ids;
  my $reader = $schemas->compile(READER => $type, ids => \%ids);

  while(1)
  {   %ids = ();
      $reader->($data)
  }

But I am not sure yet, because there also is a
  $xml->getElementById('myid');

So... still needs some thoughts.
-- 
Regards,

               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark at Overmeer.net                          solutions at overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net




More information about the Xml-compile mailing list