Benson, It is the *type* of the attribute not its name which determines whether it's an ID. This is usually determined by a type definition in an XML Schema or DTD, but can also be assigned programmatically by the user (see the Element.setIdAttribute*() methods). More info here [1].
Thanks. [1] http://www.w3.org/TR/DOM-Level-3-Core/core.html#Attr-isId Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [email protected] E-mail: [email protected] Benson Margulies <[email protected]> wrote on 08/06/2010 08:08:41 AM: > The javadoc for the Document class has the following note under > getElementById. > > Note: Attributes with the name "ID" or "id" are not of type ID > unless so defined > > So, I read an XHTML doc into the DOM (using Xerces 2.9.1). > > The doc has a plain old <p id='fribble'> in it. > > I call getElementById("fribble"), and it returns null. > > I use XPath to get "//*[id='fribble']", and all is well. > > So, the question is, what causes the DocumentBuilder to actually mark > ID attributes as 'so defined?' > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected]
