XML DOM - Nodes

In this chapter, we will study about the XML DOM Nodes. Every XML DOM contains the information in hierarchical units called Nodes and the DOM describes these nodes and the relationship between them.

Node Types

The following flowchart shows all the node types −


The most common types of nodes in XML are −

  • Document Node − Complete XML document structure is a document node.

  • Element Node − Every XML element is an element node. This is also the only type of node that can have attributes.

  • Attribute Node − Each attribute is considered an attribute node. It contains information about an element node, but is not actually considered to be children of the element.

  • Text Node − The document texts are considered as text node. It can consist of more information or just white space.

Some less common types of nodes are −

  • CData Node − This node contains information that should not be analyzed by the parser. Instead, it should just be passed on as plain text.

  • Comment Node − This node includes information about the data, and is usually ignored by the application.

  • Processing Instructions Node − This node contains information specifically aimed at the application.

  • Document Fragments Node

  • Entities Node

  • Entity reference nodes

  • Notations Node