Only the good die young
All the evil seem to live forever
Iron Maiden - Seventh Son Of A Seventh Son (1988)
Some links:
Only the good die young
All the evil seem to live forever
Iron Maiden - Seventh Son Of A Seventh Son (1988)
Some links:
Probably a more better title could be “The hell of NodeList and a bad boy that doesn’t read the documentation” (with Java 1.5).
Yes, this little thing (reading documentation) is a very good thing if you want to have headaches working with NodeLists.
The summary of this painful lesson is:
The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live. (http://java.sun.com/j2se/1.5.0/docs/api/org/w3c/dom/NodeList.html)
that is, if you change or remove nodes, your changing and removing directly to the document.
Note that we directly implement the DOM’s NodeIterator interface. We do not emulate all the behavior of the standard NodeIterator. In particular, we do not guarantee to present a “live view” of the document …
(http://xml.apache.org/xalan-j/apidocs/org/apache/xpath/NodeSet.html)
This means not is the same a NodeList returnes by a getChildNodes() than a NodeList returned by an xpath evaluate() method.