JAXP DOM: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 24: Line 24:
=Component Packages=
=Component Packages=


* <tt>[https://docs.oracle.com/javase/8/docs/api/javax/xml/parsers/package-frame.html javax.xml.parsers]</tt>
* <tt>[https://docs.oracle.com/javase/8/docs/api/javax/xml/parsers/package-frame.html javax.xml.parsers]</tt> defines <tt>DocumentBuilderFactory</tt> and <tt>DocumentBuilder</tt> classes, and error types.
* <tt>[https://docs.oracle.com/javase/8/docs/api/org/w3c/dom/package-frame.html org.w3c.dom]</tt> defines the Document class and other DOM components.
* <tt>[https://docs.oracle.com/javase/8/docs/api/org/w3c/dom/package-frame.html org.w3c.dom]</tt> defines the Document class and other DOM components.

Revision as of 20:51, 9 November 2016

Internal

Overview

The JAXP DOM API is defined by W3C. The parsers implementing the DOM API translates an entire XML document into a memory tree structure.

The parsing process begins by using DocumentBuilderFactory to create a DocumentBuilder instance. The actual implementation is dictated by the value of the javax.xml.parsers.DocumentBuilderFactory system property. The DocumentBuilder produces a Document object as a result of a parse() method invocation.

Unlike an event-driver parser API, the DOM API is memory and CPU intensive.

The Document tree elements are low level data structures. For higher level object structures, use JDOM or dom4j parsers instead.

DOM Example

DOM Example

Component Packages

  • javax.xml.parsers defines DocumentBuilderFactory and DocumentBuilder classes, and error types.
  • org.w3c.dom defines the Document class and other DOM components.