Whoops, please ignore what I said about the HTML DOM.  In fact, a custom variant
of the standard DOM was being used.  The HTML DOM works fine because of the
fallback recursing of the document looking for elements with an attribute named
"id" with the given value if super.getElementById("myId") fails to find the
element.

However, my question about whether importNode()/adoptNode() still stands for
non-HTML DOM situations (or even the HTML DOM if "id" attributes are properly
registered as of type "ID").  Shouldn't Xerces transfer the ID'ness of
attributes marked as being of type "ID" in the source document to the
destination document that the node is being imported/adopted into so we get the
following bahavior?...

Node srcNode source.getElementById("myId"); //returns non-null value
dest.getElementById("myId"); //non-existent, so returns null value
someDestNode.appendChild(dest.adoptNode(srcNode));
dest.getElementById("myId"); //returns non-null value now that it exists


This seems like it would be rational behavior to me, but it doesn't appear to
work in Xerces-2.9.0.


Jake

Quoting Jacob Kjome <[EMAIL PROTECTED]>:

>
> I'm wondering whether or not I should expect that if I import/adopt a
> node from a source DOM, that attributes of type ID on the
> imported/adopted nodes should be found by getElementById() in the
> destination DOM.  The behavior I'm seeing is that getElementById()
> fails to find the elemements (null is returned).
>
> Can anyone provide some insight on what I should expect?  If the type
> of the attributes are not carried over, what is one to do?  For
> non-HTML DOM's, getElementById() can apply to an attribute of any
> name, as long as it was marked as of type ID, so it's not like I
> recurse the DOM for "id" attributes, as I might in the HTML DOM.
>
> Actually, when I use the HTML DOM, I seem to have the same problem
> and I wouldn't expect it there because if
> HTMLDocument.getElementById() can't find an element with an attribute
> registered as of type ID with the specified value, it falls back to
> recursing the DOM looking for "id" attributes with the specified
> value.  Why is it not finding the elements?  For instance (pretend
> these are HTML documents, and note that this is from a conversation
> on the XMLC list [1])...
>
> page 1:
> -----
> <page1>
>    <node id="wherePage2ContentGoes"></node>
> </page1>
> -----
>
> page 2:
> -----
> <page2>
>    <node id="content">
>      Stuff to be transferred to page1.
>      <node id="needToMatch">this node</node>
>    </node>
> </page2>
> -----
>
> // import content from page 2
> Node destNode = page1.getElementById("wherePage2ContentGoes");
> Node srcNode = page2.getElementById("content");
> destNode.appendChild(page1.importNode(srcNode, true));
>
> ...
>
> // then later:
> Node match = page1.getElementById("needToMatch");  // fails (match == null)
>
>
> Thoughts?
>
> Jake
>
> [1] http://mail-archive.objectweb.org/xmlc/2007-01/msg00016.html
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to