23.1. Parsing XML Documents with DOM Level 2

The Document Object Model (DOM) represents an entire XML document in a tree-like data structure that can be easily manipulated by a Java program. The advantages of DOM are that it is relatively simple to use and you can modify the data structure in addition to extracting data from it. However, the disadvantage is that DOM parses and stores the entire document, even if you only care about part of it. Section 23.3 (Parsing XML Documents with SAX 2.0) discusses an alternative approach appropriate for cases when you are dealing with very large XML documents but care about only small sections of them.

Installation and Setup

DOM is not a standard part of either Java 2 Standard Edition or the servlet and ...

Get Core Web Programming, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.