O'Reilly logo

XML and Java™ from scratch by Nicholas Chase

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required