Re: [xml] DTD ID attribute



On Mon, Dec 19, 2005 at 03:52:05PM +0000, Daine Mamacos wrote:
I was wondering about this DTD ID attribute.
In the DTD if you specify something like:
<!DOCTYPE tree [
<!ATTLIST content content_id ID #IMPLIED>
]>
the content_id works as being purly numerical.
If you don't prefix this with a letter (NCName) you can still fetch the
element  by fetching it by it's id.
however, if you try validate the document, and it has these id's as purly
numerical, it fails.
There is very little documentation clarifying whether this field can be
numeric only or not. I've searched a lot of WC3 and can't find much about it.
Is it a bug that one can still search on this id dispite it not being
valid(NCName)?

  it's an validity error to use a numeric value for an ID as an Name
must start with a letter, so don't do this !
    http://www.w3.org/TR/REC-xml/#id
    http://www.w3.org/TR/REC-xml/#NT-Name
   
  Now XPath does not require a document to be valid, libxml2 used to 
error when asked to lookup ID which were not NCNames, but as all other
implementations failed to check this I realigned libxml2 behaviour with
what others implemented, but I blame them for the confusion.

Daniel

-- 
Daniel Veillard      | Red Hat http://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]