11.3. The DOM Architecture

11.3.1. The Concept of a Node

The most fundamental concept in DOM is that of a node. A document is a collection of Node objects joined into a hierarchical structure. Each node has a nodeType variable that specifies what type of node it is. There are 12 node types in DOM level 1. More will be added in the future as more DOM levels are added. We concentrate on the four most important ones:

  • Document An XML document has exactly one Document node. This is the container node for all other nodes. The first child of the Document node is the root element node of the XML or HTML document.

  • Element Each element in an XML document has its own Element node. Attributes associated with an element are accessed via this node. Each attribute ...

Get XML Processing with Python 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.