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_id:
    <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 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.