The Java API for XML Processing, or JAXP (pronounced /ˈdʒækspiː/ JAKS-pee), is one of the Java XML programming APIs. It provides the capability of validating and parsing XML documents. The three basic parsing interfaces are:
In addition to the parsing interfaces, the API provides an XSLT interface to provide data and structural transformations on an XML document. JAXP was developed under the Java Community Process as JSR 5 (JAXP 1.0) and JSR 63 (JAXP 1.1 and 1.2).
JAXP version 1.4.4 was released in September 3, 2010. JAXP 1.3 was end-of-lifed on February 12, 2008.
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
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.
Full article ▸