1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3.0//EN"
"https://docbook.org/xml/4.3/docbookx.dtd">
<article revision="20200126" status="rough">
<title>Installing XOM</title>
<para>
XOM is a library. By itself, it doesn't do much of anything. It exists
only to be used by other programs. It requires Java 1.5 or later.
</para>
<para>
To install it you'll need to place the XOM JAR archive somewhere in your
<envar>CLASSPATH</envar>. This archive is the file named something like <filename>xom-1.3.9.jar</filename>.
(The version number may have changed if I've forgotten
to update this document.) You can either put it in your <filename class="directory">jre/lib/ext</filename>
directory, add <filename>xom-1.3.9.jar</filename> to your <envar>CLASSPATH</envar> environment variable, or
use the <option>-classpath</option> option when invoking <command>javac</command> and
<command>java</command>.
</para>
<para>To check your download you can run one of the sample programs found in
the <filename>xom-samples.jar</filename> file. For instance, <classname>nu.xom.samples.PrettyPrinter</classname>
class formats an XML document by inserting and removing white space
around element boundaries. In Java 1.4 and later you can run it from the
command line like this:</para>
<screen>$ java -classpath xom-samples.jar:xom-1.3.9.jar nu.xom.samples.PrettyPrinter filename.xml</screen>
<para>The versions of <filename>xalan.jar</filename>, <filename>xercesImpl.jar</filename>, and <filename>xml-apis.jar</filename> found in the <filename class="directory">lib</filename> directory
are quite a bit faster and less buggy than the ones bundled with the JDK, so you may well want to use them. For example,
</para>
<screen>$ java -classpath xom-samples.jar:xom-1.3.9:lib/xml-apis.jar:lib/xercesImpl.jar:lib/xalan.jar nu.xom.samples.PrettyPrinter filename.xml</screen>
<para>
You can leave out <filename>xalan.jar</filename> if you don't use any of the classes in
<literal>nu.xom.xslt</literal>. <filename>junit.jar</filename>
is only used for testing, and is
not needed for normal operation of XOM.
</para>
<articleinfo>
<author>
<firstname>Elliotte</firstname>
<othername>Rusty</othername>
<surname>Harold</surname>
</author>
<authorinitials>ERH</authorinitials>
<copyright>
<year>2005, 2016, 2019, 2020, 2023</year>
<holder>Elliotte Rusty Harold</holder>
</copyright>
</articleinfo>
</article>
|