Table of Contents
The xml-common package doesn't do much for the end user other than provide informative documentation. And lets be honest, most of you end users (and I'm no exception), won't bother to read it.
The following sections will guide you in your quest of using tools like keyval2sh which require a system setup for processing XML documents.
At a minimum, a system should have the following packages installed:
Since the bash utility is available on such a wide variety of platforms, Paul has made it his shell scripting language of choice. You can determine if your system has bash installed properly using the following command:
[pkb@salsa common]
/bin/bash --version
GNU bash, version 2.05b.0(1)-release (i386-redhat-linux-gnu)
Copyright (C) 2002 Free Software Foundation, Inc.
[pkb@salsa common]
If your system doesn't have bash installed, additional information on installing bash can be found in the Third Party Software chapter.
You will need a Java run time environment (version
1.4.2 or later). This package includes the
org.apache.xalan.xslt.Process
class, which enables one to apply XSL style sheets to
XML documents allowing us to translate XML source
files into other useful entities. It may be possible to
use an earlier version of the Java run time environment,
however, it will be up to you locate and install the
Xalan-Java package yourself (you will be on
your own).
You can use the following command to determine what version of Java you have installed on your system:
[pkb@salsa common]
java -version
java version "1.4.2_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03)
Java HotSpot(TM) Client VM (build 1.4.2_02-b03, mixed mode)
[pkb@salsa common]
If your system indicates that you have a version of
Java installed that is 1.4 or higher, they you are
probably set to go. You can further test this by verifying
that the
org.apache.xalan.xslt.Process
class
is available for applying XSL templates to XML
documents by using the following command:
[pkb@salsa common]
java org.apache.xalan.xslt.Process
Xalan-J command line Process class options:
-Common Options-
[-XSLTC (use XSLTC for transformation)]
[-IN inputXMLURL]
[-XSL XSLTransformationURL]
... bunch more output - you'll have to hit return a couple of times ...
[-XX (turns on additional debugging message output)]
[-XT (use translet to transform if possible)]
[pkb@salsa common]
If the above test produces an error message (typically something containing java.lang.NoClassDefFoundError), then you will need to update your Java run time environment. Additional information related to installing the Java 2 Software Edition can be found in the Third Party Software chapter.
When processing XML documents, validation is often desirable. Validation is done against the XML document's associated DTD or XML Schema. There is typically one public location for a DTD or XML Schema file (think Internet here). Often it is desirable to have a local copy of the schema available on your system. Having a local copy means you won't need to access the Internet when you process your XML documents. This makes things run quicker (and avoids the Internet dependency - and proxy server setup issues).
The xml-commons-resolver package provides a mechanism to read catalog files telling the XLST process where it can find DTD and XML Schema files on the local system. If not found on the local system, the XLST process should then still fall back to pulling it from the Internet.
You can use the following command to determine if you have the xml-commons-resolver package properly installed (you should not see an error message):
[pkb@salsa common]
java org.apache.xml.resolver.Version
XmlResolver 1.0
[pkb@salsa common]
If the above test produces an error message
(typically something containing
java.lang.NoClassDefFoundError),
then you will need to install the xml-commons-resolver
package on your system. This involves creating a
lib/endorsed
directory under your
Java run time direcorty (if it doesn't already exist), and
then placing the necessary JAR file
(found at http://www.ibiblio.org/maven/xml-resolver/jars/xml-resolver-1.1.jar)
in the lib/endorsed
directory. Assuming the path to your Java run time
environment is
/opt/j2sdk1.4.2_03/jre
, then the
installation of this package can be done in the following
manner (assuming you have the wget
utility properly installed and configured for your
system):
[pkb@guacamole keyval]$
su -
Password:
bash-2.03#
cd /opt/j2sdk1.4.2_03/jre/lib
bash-2.03#
if [ ! -d endorsed ]; then mkdir endorsed; fi
bash-2.03#
cd endorsed
bash-2.03#
wget -nd -nH http://www.ibiblio.org/maven/xml-resolver/jars/xml-resolver-1.1.jar
--09:56:23-- http://www.ibiblio.org/maven/xml-resolver/jars/xml-resolver-1.1.jar
=> `resolver-latest.jar'
Connecting to xml.apache.org:80... connected!
HTTP request sent, awaiting response... 200 OK
Length: 51,861 [application/octet-stream]
0K -> .......... .......... .......... .......... .......... [ 98%]
50K -> [100%]
09:56:24 (89.16 KB/s) - `resolver-latest.jar' saved [51861/51861]
bash-2.03#
Additional information related to installing the xml-commons-resolver package can be found in the Third Party Software chapter.
The docbook-xsl package does not need to be installed on your local system as long as Internet access is available. However, having a local copy of the docbook-xsl package installed can speed up the processing of DocBook.org files.
You can typically tell if your system has the docbook-xsl package installed, using the following command:
[pkb@salsa pkb]$
ls /usr/share/sgml/docbook
docbook-xsl-1.64.1 sgml-dtd-3.1-1.0-17 xmlcatalog
dsssl-stylesheets sgml-dtd-4.0-1.0-17 xml-dtd-4.1.2-1.0-17
dsssl-stylesheets-1.76 sgml-dtd-4.1-1.0-17 xml-dtd-4.2-1.0-17
gnome-customization-0.1 sgml-dtd-4.2-1.0-17 xsl-stylesheets
sgml-dtd-3.0-1.0-17 utils-0.6.12 yelp
[pkb@salsa pkb]$
If you don't see output similar to the above, it indicates that the docbook-xsl package is not installed on your system. Or, that it is installed in a different directory than we were expecting.
If you system has the docbook-xsl package
installed in a different directory, you will either need
to add a symbolic link, or set the
XML_COMMON_DOCBOOK
environment variable to
the directory it can be found at.
If your system doesn't have docbook-xsl package installed and you'd like to install a local copy, additional information on installing docbook-xsl can be found in the Third Party Software chapter.
XML_COMMON_JAVA
It is common to have more than one Java run time
installed on a system. If your default Java run time is
an older version, but you know the path to a more recent
version (1.4
or later), you can set
the XML_COMMON_JAVA
environment variable
to this location. In addition, you can also include
proxy settings if your local system can not directly
access the Internet. For example, on the system I use in
Arizona, I set this environment variable as shown below,
and then test it by running a test Java application I
have that retrieves information from the
Internet:
[pkb@salsa common]
export XML_COMMON_JAVA="/liz3/pkb/usr/j2re1.4.2_03/bin/java \
-DproxyHost=172.26.0.232 -DproxyPort=3128"
[pkb@salsa common]
$XML_COMMON_JAVA -cp ~pkb/java com.ccg.net.URLCat \
-url http://www.networksecuritytoolkit.org/nst/cgi-bin/ip.cgi
read:0 bytes
192.101.77.176
[pkb@salsa common]
XML_COMMON_DOCBOOK
Paul has found the DocBook.org tools to be an
invaluable asset when creating software documentation
(including man pages). The DocBook.org tools are freely
available, and basic text and HTML
output can be had for the price of time in configuring
your Java environment. In order for you the developer
the experience the sheer joy and frustration of working
with DocBook.org style files, you will want to install the
docbook-xsl package locally on your system. This package
provides the XSL files necessary to translate the
XML DocBook.org files into things like
HTML and man pages. By default, we
assume that you don't have a local copy installed and use
http://docbook.sourceforge.net/release/xsl/current
as the anchor point. If
you did take the time to install a local copy on your
system (to speed up the build process), you should
set the XML_COMMON_DOCBOOK
environment
variable to point the directory such that html/chunk.xsl
is found. For example:
[pkb@salsa common]
export XML_COMMON_DOCBOOK="/usr/share/sgml/docbook/xsl-stylesheets"
[pkb@salsa common]
if [ -f "$XML_COMMON_DOCBOOK/html/chunk.xsl" ]; then echo "OK"; fi
[pkb@salsa common]
If you do choose to install the xml-common
package onto a system with which has a web server running, you
will probably want to configure your web server such that the
documentation for the xml-common package maps to:
http://YOURHOST/vaisala/xml/common/
.
For a Solaris system running
apache, you will want to add the
following to the end of your
httpd.conf
configuration
file:
Figure 2.1. Addition to httpd.conf
# # Anchor local XML documentation available at /vaisala/xml/common # Alias /vaisala/xml "/opt/VAIxml/share/doc"
For a RedHat Linux system running
apache, you should not need to do
anything, as the documentation files are installed under the
/var/www/html
directory such that your
web server should find them without configuration.