Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

JVM Languages

Easy DOM Parsing in Java



Related Reading


More Insights




RahulR618

Hello! Can I get the complete code for generating DOM trees from any web page? I am in an urgent need of it.

MohammadS548

How to use these helper functions if I have more than one Executive Nodes in the XML Document?

eric_j_bruno

I'm not sure if it has improved. However, I often do the same as you suggest here, and walk through XML. This doesn't scale, however, but it is an option in some cases.

Granger44

I found that early versions of Java had performance issues with the DOM XML (I was mostly using XPath). It was enough that I switched to doing my own tree walking operations to get a 2 to 3 times performance increase. Have the newer versions done anything to change this?

father_ramon

I find this article deeply disturbing in the number of bad practices that it naively encourages:

* Completely ignores namespaces throughout.
* Uses equalsIgnoreCase when comparing names, even though XML names are supposed to be case-sensitive.
* Uses internal classes of the Xerces implementation instead of the standard JAXP methods.
* getNodeValue() stops at the first text node. Even for simple content there could be multiple text nodes, embedded comments, etc., not to mention CDATA sections, entity references, etc.

I cringe every time I see these sort of mistakes in the wild and am very disappointed to find them in a Dr. Dobbs article.

boone111

What happens when the xml contains the same element name in different sections of the XML?