Re: [xml] DTD/Schema -> ID = Name or NCName



On Fri, Jul 25, 2003 at 11:30:49AM +0200, Johann Richard wrote:
Daniel,

I am somewhat desperate about a problem with the latest LibXML (2.5.8).
I have XIncludes and use, for some reason(!) and some time, ID's of the
form "class:specifier", e.g. 

<section id="section:1-00-3435"/>

Moreover, I use the DocBook DTD to validate my XML against. For that, as
you certainly know, ID is defined as "NameChar", allowing, as far as I
understood, colons in ID values. [http://www.w3.org/TR/REC-xml#NT-Name]

I found that the XPath implementation in xpath.c checks the ID with
"xmlValidateNCName()", obviously making Xinclude's with colon's in ID's
fail.

I know that in XML Schema, an ID must be of type "NCName", but as far as
I understood, colons are really allowed for DTD based XML. I remember,

  Well, basically you should not use ':' in names they are of reserved use
by the XML spec and that was clearly stated even from the first revision 
of the spec. 
  Second if you use XInclude, your document must conform to the namespace
spec, and the namespace spec forbids using ':' in NCNames. 
  Third XPath also requires the document to conform to the namespace
spec so trying to use XPath on a document which such IDs is certain 
to lead to troubles.
  Conclusion: 
    Instead of trying to guess whether designing such identifier was
    okay by checking how implementation works, you should have checked
    the spec or asked here or on XML-Dev. In both case you would have
    gotten an immediate answer that it was not a good idea.

  Conformance is what guarantee predicatbility and portability. It cannot
be asserted by trial against implementations. I'm sorry for your problem
but I think it's an useful lesson, you really have to redefine your 
identifiers, it's unfortunate but there is no other option.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]