[Previous] [Contents] [Next]


Getting Our Conversion Up and Running


Now that we know the content of the SAX distribution and how we can implement the SAX interfaces, we need to put all the pieces together.
Figure 15.4 Our Java development environment.

The needed components are as follows:

A SAX enabled parser
The SAX distribution
The event handlers

We have two SAX enabled parsers installed on our system (see Day 5 "Checking Well-formedness," and Day 9 "Checking Validity"):

xml4j of IBM
DXP of Datachannel

Note the full classname of their SAXdriver used in our convert class:

com.ibm.xml.parser.SAXDriver for xml4j
com.datachannel.xml.sax.SAXDriver for DXP

If needed, you can change your supporting parser by changing this classname. You don't have to change anything else in your code.

You'll recall from Day 14 that this was one of the main purposes of the SAX initiative: to be able to change parsers without changing code.

We need the SAX distribution (saxjava-1_0.zip) unzipped on our system, as well as the two compiled classes: convert.class (the main program) and OurHandler.class (which implements the event handlers).

Now we need to be sure that all the needed classes can be found by including their paths to the CLASSPATH variable.



In our case our CLASSPATH is:

C:\SAX;C:\xml4j\xml4j.jar;c:\datachannel\dxp\classes;.;
c:\progra~1\kawa30\classes.zip;c:\jdk1.1.5\lib\classes.zip

Once this is done the command to be run from the command-line is:

java.exe convert

convert is the name of our main program (class).

This generates the file out.htm, with our musicians in an HTML table.

[Previous] [Contents] [Next]