The Structure of a DOM Document

Until now, we've been using the terms element and node almost as though they are synonymous. In some cases they are; all elements are nodes. But not all nodes are elements. In fact, Element is a subclass of Node, and just one of many types.

Twelve types of nodes exist. They are as follows:

  • Attributes— The usual attributes of an element that we've already seen, such as

    <order order_id="123ABC"></order>
  • CData sections— A section of text that the processor should not attempt to parse. In an XHTML page, scripts are often CData sections because they contain markup and other text we don't want processed. CData sections are set off with special characters that tell the processor to ignore them, as in

     The time ...

Get XML and Java™ from scratch now with O’Reilly online learning.

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