Installing Xerces


Installing Xerces is relatively simple. The first thing you need to do is obtain a Xerces build. You can do this by going to http://xml.apache.org/dist/xerces-j, where you’ll see a list of the current official Xerces builds. (You can ignore the Xerces 1.X builds.)

The Xerces build for a particular version of Xerces is divided into three distributions. Let’s use Xerces 2.4.0 as an example. The binary distribution of Xerces 2.4.0 is in a file named Xerces-J-bin.2.4.0.xxx, where xxx is either .zip or .tar.gz, depending on the kind of compressed archive format you need. Typically, people on Windows use a .zip file, whereas people on MacOS X, Linux, and UNIX of various sorts use a .tar.gz file. There are also .xxx.sig files, which are detached PGP signatures of the corresponding .xxx file. So, Xerces-J-bin.2.4.zip.sig contains the signature file for the Xerces-J-bin2.4.zip distribution file. You can use PGP and the signature file to verify that the contents of the distribution have not been tampered with.

In addition to the binary distribution, you can download a source distribution, Xerces-J-src.2.4.zip, and a tools distribution, Xerces-J-tools-2.4.0.zip. You’ll need the tools distribution in order to build the Xerces documentation.

We’ll focus on installing the binary distribution. Once you’ve downloaded it, unpack it using a zip-file utility or tar and gzip for the .tar.gz files. Doing so creates a directory called xerces-2.4.0 in either the current directory or the directory you specified to your archiving utility. The key files in this directory are

  • data—A directory containing sample XML files.

  • docs—A directory containing all the documentation.

  • Readme.html—The jump-off point for the Xerces documentation; open it with your Web browser.

  • samples—A directory containing the source code for the samples.

  • xercesImpl.jar—A jar file containing the parser implementation.

  • xercesSamples.jar—A jar file containing the sample applications.

  • xml-apis.jar—A jar file containing the parsing APIs (SAX, DOM, and so on).

You must include xml-apis.jar and xercesImpl.jar in your Java classpath in order to use Xerces in your application. There are a variety of ways to accomplish this, including setting the CLASSPATH environment variable in your DOS Command window or UNIX shell window. You can also set the CLASSPATH variable for the application server you’re using.

Another installation option is to make Xerces the default XML parser for your JDK installation. This option only works for JDK 1.3 and above.

JDK 1.3 introduced an Extension Mechanism for the JDK. It works like this. The JDK installation includes a special extensions directory where you can place jar files that contain extensions to Java. If JAVA_HOME is the directory where your JDK has been installed, then the extensions directory is <JAVA_HOME>\jre\lib\ext using Windows file delimiters and <JAVA_HOME>/jre/lib/ext using UNIX file delimiters.

If you’re using JDK 1.4 or above, you should use the Endorsed Standards Override Mechanism, not the Extension Mechanism. The JDK 1.4 Endorsed Standards Override Mechanism works like the Extension Mechanism, but it’s specifically designed to allow incremental updates of packages specified by the JCP. The major operational difference between the Extension Mechanism and the Endorsed Standards Override Mechanism is that the directory name is different. The Windows directory is named <JAVA_HOME>\jre\lib\endorsed, and the UNIX directory is named <JAVA_HOME>/jre/lib/endorsed.




Professional XML Development with Apache Tools. Xerces, Xalan, FOP, Cocoon, Axis, Xindice
Professional XML Development with Apache Tools: Xerces, Xalan, FOP, Cocoon, Axis, Xindice (Wrox Professional Guides)
ISBN: 0764543555
EAN: 2147483647
Year: 2003
Pages: 95

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net