
XML and Java • 365
When DOM parsing happens, the whole XML document is read in memory in the form of a tree-like
structure. This tree-like structure, when flattened, has many elements, attributes, etc., depending on the
contents of the XML document. This is made available to a Java program in the form of various nodes. The
collection of all these nodes (that is, the tree-like structure in memory) is called a node list. To be able to deal
with these nodes of a node list, we need Java data structures so that we can run through these nodes. The idea
is illustrated in Figure 7.27.
<catalogue>
<title>
<?xml version=”1.0”?>
<catalogue>
<cd available = ...