O'Reilly logo

Java Enterprise in a Nutshell, Second Edition by David Flanagan, Jim Farley, William Crawford

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Java API for XML Processing

The JAXP API is an optional package for Java 1.1 and above. It is also a standard component of the J2EE 1.3 platform. 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 ships with Sun’s Crimson XML parser and the Xalan XSL engine from the Apache XML project (again, see http://xml.apache.org). Future JAXP implementations will likely replace Crimson with Xerces. There are still variations in support for different levels of functionality across parser implementations. The examples in this chapter have been tested with the Crimson parser that ships with JAXP and all other Sun products.

JAXP 1.1 is included in the J2EE 1.3 platform. To use JAXP with JDK 1.1 or Java2, you can download the reference implementation from http://java.sun.com/xml/. You will need to add the jaxp.jar file to your CLASSPATH, as well as the JAR files containing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required