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

Mark Overmeer mark at overmeer.net
Thu May 15 23:21:36 BST 2008


Other people's input welcome!

* MENG Xin (zinces at gmail.com) [080515 09:54]:
>    I'm not very familar about spec. Here is text from XML Schema 2nd Edtion,
>    O'Reilly, ISBN 0-596-00252-1, chapter 16 Datatype Reference Guide, xs:ID
>    section:

Well, that's second-hand info.
The XML-Schema spec is at http://www.w3.org/TR/xmlschema-2/#ID and
says really nothing useful:
  3.3.8 ID
  [Definition:] ID represents the ID attribute type from [XML 1.0 (Second
  Edition)]. The ·value space· of ID is the set of all strings that
  ·match· the NCName production in [Namespaces in XML]. The ·lexical
  space· of ID is the set of all strings that ·match· the NCName
  production in [Namespaces in XML]. The ·base type· of ID is NCName.

The XML 1.0 spec says:

 http://www.w3.org/TR/2000/WD-xml-2e-20000814
  Validity constraint: ID
     Values of type ID must match the Name production. A name must not
     appear more than once in an XML document as a value of this type;
     i.e., ID values must uniquely identify the elements which bear them.

The RFC definition of "must" is less strong than "shall".  The former
means: "should be, but not deadly", where the latter means: error.
I do not known how to interpret the XML use of the word "must".

Anyone else: what is correct behavior?  An error or warning on double
IDs, of simply ignore it?

> And I know that validator integrated in oXygen XML editor for Eclipse also
> does such task.
> So I guess validators should guarantee the unique restriction of xs:ID.
> After all, it is not difficult to implement, right?

> I quote the correct behavior is just to show my superise: xs:pattern based
> on xs:ID can be checked perfectly, but xs:ID itself is not checked. That's
> all.

There are quite some different needs from checking seperate values against
some rules (very locally) and document global ID administration.  Although
the second is possible (of course).

-- 
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