Installing the xml-keyval Package

The xml-keyval package will be distributed in Solaris package form and in a RedHat Linux RPM. The package has no architecture dependencies (there are no binaries), so, you should simply download the package you need and install it in the manner which is the standard for your operating system. Additional details on locating and installing the xml-keyval package can be found in the Third Party Software chapter.

The following shows an example of installing the Solaris package (it uses wget to pull VAIxml-keyval-1.0.0-5.tar.gz from the Internet).

[root@salsa root]# cd /tmp
[root@salsa tmp]# DURL="http://www.mekwin.com/vaisala/xml/download/pkg"
[root@salsa tmp]# wget -O - "$DURL"/VAIxml-keyval-1.0.0-5.tar.gz | gzip -dc | tar xf -
--08:35:10--  http://www.mekwin.com/vaisala/xml/download/pkg/VAIxml-keyval-1.0.0-5.tar.gz
           => `-'
Connecting to 192.168.0.2:3128... connected!
Proxy request sent, awaiting response... 200 OK
Length: 56,663 [application/x-tar]
 
    0K -> .......... .......... .......... .......... .......... [ 90%]
   50K -> .....                                                  [100%]
 
08:35:11 (180.83 KB/s) - `-' saved [56663/56663]
 
[root@salsa tmp]# pkgadd -d . VAIxml-keyval

... lots of output ...

Installation of <VAIxml-keyval> was successful.
[root@salsa tmp]# rm -fr /tmp/VAIxml-keyval
[root@salsa tmp]# 

The following shows an example of installing the RedHat package (it uses wget to pull vaisala-xml-keyval-1.0.0-5.noarch.rpm from the Internet).

[root@salsa root]# cd /tmp
[root@salsa tmp]# DURL="http://www.mekwin.com/vaisala/xml/download/rpm"
[root@salsa tmp]# wget -nH -nd "$DURL"/vaisala-xml-keyval-1.0.0-5.noarch.rpm
--08:35:10--  http://www.mekwin.com/vaisala/xml/download/rpm/vaisala-xml-keyval-1.0.0-5.noarch.rpm
           => `vaisala-xml-keyval-1.0.0-5.rpm'
Connecting to 192.168.0.2:3128... connected!
Proxy request sent, awaiting response... 200 OK
Length: 56,663 [application/x-tar]
 
    0K -> .......... .......... .......... .......... .......... [ 90%]
   50K -> .....                                                  [100%]
 
08:35:11 (180.83 KB/s) - `vaisals-xml-keyval-1.0.0-5.noarch.rpm' saved [56663/56663]

[root@salsa tmp]# rpm -ivh /tmp/vaisala-xml-keyval-1.0.0-5.noarch.rpm
Preparing...                ########################################### [100%]
   1:vaisala-xml-keyval     ########################################### [100%]
[root@salsa tmp]# rpm -qi vaisala-xml-keyval
Name        : vaisala-xml-keyval           Relocations: (not relocateable)
Version     : 1.0.0                             Vendor: Vaisala Inc
Release     : 5                             Build Date: Wed 17 Mar 2004 02:00:16 PM EST
Install Date: Wed 17 Mar 2004 02:03:18 PM EST      Build Host: salsa.linux.bogus
Group       : Applications/Text             Source RPM: vaisala-xml-keyval-1.0.0-5.src.rpm
Size        : 255138                           License: Copyright 2004 Vaisala Inc
Signature   : (none)
Packager    : Vaisala Inc <http://www.vaisala.com/>
URL         : http://www.mekwin.com/vaisala/xml/vaisala/xml/keyval/index.html
Summary     : Utilities for working with key/value definitions
Description :
 
This is the keyval package which provides both a definition (DTD) and
several handy scripts for generating source code and documentation
from a single XML document (its pretty dang handy if you want to make
a program that reads in a simple key/value pair configuration file, or
script that you'd like to have validate its command line arguments).
[root@salsa tmp]# rm -f /tmp/vaisala-xml-keyval-1.0.0-5.noarch.rpm
[root@salsa tmp]# 

If you are a developer and have access to the CVS repository, you can install the package using the following (you may need to adjust some values described in the section called “Environment Variables”). You can use configure --help for some hints to the available options - if you don't want to blindly accept my example:

[pkb@salsa pkb]$ cvs checkout xml/common xml/keyval

... lots of CVS output ...

[pkb@salsa pkb]$ cd xml/common
[pkb@salsa common]$ ./configure --docs $HOME/public_html/vaisala/xml \
--docs-url /~pkb/vaisala/xml
 
Holy cow Batman! It looks like it worked! Use:
 
  make
 
To build, and then:
 
  make install
 
[pkb@salsa common]$ make install

... lots of output - might fail if you need to set XML_COMMON_JAVA ...
 
[pkb@salsa common]$ cd ../keyval
[pkb@salsa keyval]$ ./configure --docs $HTMLROOT/vaisala/xml \
--docs-url /~pkb/vaisala/xml
 
Holy cow Batman! It looks like it worked! Use:
 
  make
 
To build, and then:
 
  make install
 
[pkb@salsa keyval]$ make install
 
... lots more output ...

[pkb@salsa keyval]$ ~/usr/bin/keyval2cc --help
 
Usage:
  keyval2cc [-h|--help] [-n|--name TEXT] [--reloc-cfg FILENAME]
         [--namespace TEXT] [-t|--templates true|false]
         [-l|--log-file FILENAME] [--install-query TEXT]
 
Where:
  -n|--name TEXT  Currently:[]
    Specify the name of the script you will be working on.
  --reloc-cfg FILENAME  Currently:[]
    Where to store configuration template.
  --namespace TEXT  Currently:[lp]
    Set the namespace to associate the class with.
  -t|--templates true|false  Currently:[true]
    Control whether template files are created.
  -l|--log-file FILENAME  Currently:[/dev/null]
    Log of detailed output from processing files.
  --install-query TEXT  Currently:[]
    Query information about the installed package.
  -h|--help
    Displays this usage information.
 
[pkb@salsa keyval]$ 

If you are running on a Windows machine, or have insufficient permissions to install the package directly onto your system, you can still make use of the public XSL files on the Internet to translate a <keyval> document (provided you have a recent version of Java installed). To do this, you invoke java in the following form:

java org.apache.xalan.xslt.Process -IN IFILE -OUT OFILE -XSL http://www.mekwin.com/vaisala/xml/keyval/xsl/XFILE

IFILE

The source <keyval> to be translated.

OFILE

The output file to store the results under.

XFILE

The XSL style sheet to apply. It must be one of keyval2cc.xsl, keyval2cfg.xsl, keyval2docbook_options.xsl, keyval2docbook_synopsis.xsl, keyval2hh.xsl, keyval2html.xsl, keyval2java_config.xsl, keyval2java_editor_properties.xsl, keyval2java_editor.xsl, keyval2java_help.xsl, keyval2java.xsl, keyval2m4i.xsl, keyval2sh_m4i.xsl, or keyval2sh.xsl.

As an example, the following demonstrates how one could translate the <keyval> file ldfilt_config.xml into a C++ source and header file without installing anything on the system. The example also demonstrates how tell java to use a proxy server, which allows the XSL files to be cached:

[pkb@salsa pkb]$ cd /tmp
[pkb@salsa tmp]$ RUN="java -DproxyHost=192.168.0.2 -DproxyPort=3128"
[pkb@salsa tmp]$ RUN="$RUN org.apache.xalan.xslt.Process"
[pkb@salsa tmp]$ RUN="$RUN -IN ldfilt_config.xml"
[pkb@salsa tmp]$ RUN="$RUN -XSL http://www.mekwin.com/vaisala/xml/keyval/xsl/"
[pkb@salsa tmp]$ ${RUN}keyval2hh.xsl -OUT ldfilt.hh

[pkb@salsa tmp]$ ${RUN}keyval2cc.xsl -OUT ldfilt.cc

[pkb@salsa tmp]$ ls ldfilt*
ldfilt.cc  ldfilt_config.xml  ldfilt.hh
[pkb@salsa tmp]$ 

Admittedly, it isn't particularily easy, but if you find yourself in a pinch, the above trick can come in handy.