Hi Jake,
Jacob Kjome <[EMAIL PROTECTED]> wrote on 09/24/2006 11:46:57 PM:
<snip/>
> Ok, then how about...
>
> public synchronized Element getElementById( String elementId )
> {
> Element idElement = super.getElementById(elementId);
> if (idElement != null) {
> return idElement;
> }
> idElement = getElementById( elementId, this );
> if (idElement != null) {
> idElement.setIdAttribute("id", true);
> }
> return idElement;
> }
>
> That seems to work just as well and seems like it addresses the issue
> you just mentioned, no?
Hmmm.... That's still going to have some wonky behaviour. Consider the
following code snippet:
Document doc = ...;
Attr id = ...; // name = "id", value = "foo"
System.out.println(id.isId()); // false
doc.getElementById("foo");
System.out.println(id.isId()); // true
doc.normalizeDocument(); // validate
System.out.println(id.isId()); // false
The IDness of "id" will change as a side-effect of calling
getElementById() and/or normalizeDocument(). If this attribute really is
an ID isId() should always return true. Perhaps a better way to address
this would be for the HTML DOM to enforce the IDness of these attributes
and store their values in the "identifiers" map as they're added to the
tree.
> Jake
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]