Document Trees and Parse Trees

Listing 15.1 is the same simple XML document that you saw in Chapter 12, "XML Processing Basics."

Listing 15.1. A Simple XML Document
<?xml version="1.0"?>
<!--demonstration of a parse tree-->
<xdoc>
  <greeting>Hello <emph>parsed</emph>XML!!</greeting>
  <applause type="sustained"/>
</xdoc>

The document tree is shown in Figure 15.1.

Figure 15.1. Diagram of the document tree generated in Listing 15.1.

To recap, the root of the tree is the document itself. This root has three child nodes:

  • A version declaration node, or a processing instruction node in DOM parlance.

  • A comment node.

  • An element node. This ...

Get XML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.