W3C home > Mailing lists > Public > public-xml-id@w3.org > February 2008

Re: Confirmation of xml:id behaviour

From: Daniel Veillard <veillard@redhat.com>
Date: Tue, 12 Feb 2008 07:26:51 -0500
To: Cameron McCormack <cam@mcc.id.au>
Cc: public-xml-id@w3.org
Message-ID: <20080212122651.GB31929@redhat.com>

On Tue, Feb 12, 2008 at 10:25:10PM +1100, Cameron McCormack wrote:
> Hi Daniel.
> Daniel Veillard:
> >   All I can say from an xml:id point of view is that the svg element
> > will be reported as having an attribute xml:id of type ID to the 
> > application processing the document and that the value of this
> > ID is '1' (not '0').
> Sorry, yeah meant to write '1' there, not '0'.
> >   Everything else you seems to assume looks dependand on how the
> > application interpret the XML, including the svg and script element,
> > and that xml:id cannot garantee it in itself.
> OK, so given Document.getElementById() says:
>   Returns the Element that has an ID attribute with the given value. If
>   no such element exists, this returns null.
>     — http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-getElBId
> I think it should alert true.
> It just seemed surprising to me that invalid IDs were effectively
> treated the same as valid ones, but if that’s what’s meant to happen,
> I’ll go with it.


  Each xml:id attribute is processed in the following way:
     - ID type assignment is performed with the normalized value.
  An xml:id processor must assure that the following constraints hold for all xml:id attributes:
     - The normalized value of the attribute is an NCName  ...

  An xml:id error occurs for any xml:id attribute that does not satisfy the constraints.

Hence to me the ID type assigment is done and reported to the application (that
is beginning of section 5), and an error MUST be reported to the application.
So the application get both informations. I would expect the IDness to stick
and getElementById() to work. How and if the application will report the error
sounds very dependant of the kind of application (an editor definitely should).

For the anecdote, for a long long time I tried in libxml2 to no pass non-NCNames
as ID to the applications, and got persistent continuous reports that 
applications expected to see the malformed IDs anyway (this has been buried in 
existing processes :-( ) and in the end I changed. You get the error as a 
validity kind of warning in libxml2 since this correspond to a validity
checking for XML-1.0.


Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard@redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/
Received on Tuesday, 12 February 2008 12:27:08 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 19:53:50 UTC