Java API for XML Processing

The JAXP API is bundled into the JDK as of 1.4 and is an optional package for earlier versions. It is also a standard component of the J2EE 1.3 and 1.4 platforms. XML Schema support is available only in JAXP 1.2, which is part of J2EE 1.4 and JDK 1.4. J2EE 1.3 includes the 1.1 release of JAXP, which is otherwise functionally identical. If you’re working in a Java 5.0 environment, you’re using JAXP 1.3, which adds XPath and XInclude support to the API, among other things.The full specification and a reference implementation are available from http://java.sun.com/xml.

The SAX and DOM APIs that are actually used for processing XML files don’t include a standard method for creating a parser object; this is one of the voids JAXP fills. The API provides a set of Factory objects that will create parsers or XSLT processors. Additionally, JAXP defines a programmatic interface to XSLT processors.

The actual parser and processor implementations used by JAXP are pluggable. You can use the Crimson parser , the Apache Xerces parser (available from http://xml.apache.org), or any other JAXP-compatible parser. Version 1.1 of the reference implementation shipped with Sun’s Crimson XML parser and the Xalan XSL engine from the Apache XML project (again, see http://xml.apache.org). In JAXP 1.2, the Crimson parser was replaced with the Xerces parser. There are still variations in support for different levels of functionality across parser implementations. The ...

Get Java Enterprise in a Nutshell, Third Edition 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.