DOM Interface
The DOM interface is perhaps the easiest to understand. It parses an entire XML document and constructs a complete in-memory representation of the document using the classes modeling the concepts found in the Document Object Model(DOM) Level 2 Core Specification.
The DOM parser is called a DocumentBuilder
, as it builds an in-memory Document
representation. The javax.xml.parsers.DocumentBuilder
is created by the javax.xml.parsers.DocumentBuilderFactory
. The DocumentBuilder
creates an org.w3c.dom.Document
instance, which is a tree structure containing nodes in the XML Document. Each tree node in the structure implements the org.w3c.dom.Node
interface. There are many different types of tree nodes, representing the type of data found in an XML document. The most important node types are:
- element nodes that may have attributes
- text nodes representing the text found between the start and end tags of a document element.
Refer to the Javadoc documentation of the Java package org.w3c.dom
for a complete list of node types.
Read more about this topic: Java API For XML Processing