I am trying to compare two HTML DOM documents. One has different styling information on a div element than the other, and when that difference is detected I would like to use the Node object for something else. Unfortunately the Node is not a child of the div element but a (stand-alone) node STYLE without a parent.
Is there a way to find the place in the DOM of this node?
Best regards, Cor-Paul
Update: I just noticed that this is also the case for other attributes, for example the action attribute of a form. Is this correct?
Imho this information should be a child node of the html element it belongs to.
the Node should be an org.w3c.dom.Attr and its getOwnerElement should not be null.
In general, XMLunit doesn't modify the Nodes so "normal" DOM traversal is supposed to work.
see the JavaDoc of Node#getParentNode, where it says
"The parent of this node. All nodes, except Attr, Document, DocumentFragment, Entity, and Notation may have a parent."
I have no clear idea why the DOM group decided to add a new method to travel from attribute to element and make the one that feels natural defunct.
Ah I goofed here; I was using getParentNode() instead of getOwnerElement() for attributes. Thanks :)
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.