Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] getElementById (not again.... I know, but..)

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] getElementById (not again.... I know, but..)
  • Date: Sun, 08 Oct 2006 06:28:52 -0400

John Cowan wrote:

No, it isn't. An attribute is of type ID if and only if one or more of
the following is true:

a) it is declared in the document's DTD as being of type ID, whether
or not XML validation is being done;

b) it is declared in an XML Schema as being of type xs:ID, and XML
Schema validation is being done;

c) the attribute is named "xml:id".


I don't think it's that clear in practice. For example, if you're parsing well-formed HTML there's a user expectation that all attributes named id, ID, Id, or iD are treated as IDs.

If you're using XPath on a DTDless document then elements declared as xs:ID in a W3C schema do not have type ID, and arguably xml:id elements don't either (unless declared that way in a DTD).

And what about ID-type attribute declared in a RELAX NG schema?

Like a lot of other things, "IDness" is in the eye of the beholder. It's a really nasty rabbit-hole that I've been sucked down more than once; and I'd like to avoid going there again if I can help it.

--
Elliotte Rusty Harold elharo AT metalab.unc.edu
Java I/O 2nd Edition Just Published!
http://www.cafeaulait.org/books/javaio2/
http://www.amazon.com/exec/obidos/ISBN=0596527500/ref=nosim/cafeaulaitA/




Archive powered by MHonArc 2.6.24.

Top of Page