The code examples are contained in two directories:
What will I need to build the examples?
You will need a Java development environment, such as Sun's Software Development Kit (SDK). The SDK is freely available at http://java.sun.com/j2se for Win32 and Solaris. Linux versions are available at several popular Linux sites. For the SAX examples, you will need a SAX implementation. Apace Xerces or Sun JAXP are satisfactory. SAX resources can also be found on Dave Megginsons site. The Spider example will require HTML Enable XML Parser (HEX).
What is Jikes?
Jikes is a fast Java compiler freely available from IBM. Remember that you will still need the standard runtime class libraries shipped with Suns Java 2 SDK. Read the Jikes FAQ for detailed information on how to setup and use Jikes.
How do I compile and test the SAX examples?
First change directories to the core directory. You can compile all of the core examples using one command:
javac -d .. -classpath ..;c:\xerces-2_0_0_beta\xerces.jar *.java
This assumes you have downloaded Xerces into c:\xerces-2_0_0_beta. If you download a different version or install Xerces in a different directory, adjust the path to xerces.jar appropriately in the command above. This will compile all source code in the current directory and place all compiled class files one directory up. The default rule in the supplied Makefile does the same thing.
Each of the SAX examples can executed from the source directory as follows:
SAXDemo:
java -classpath ..;c:\xerces-2_0_0_beta\xerces.jar com.madhu.xml.SAXDemo <input-xml-file>
SAXValidator:
java -classpath ..;c:\xerces-2_0_0_beta\xerces.jar com.madhu.xml.SAXValidator <input-xml-file>
SAXErrors:
java -classpath ..;c:\xerces-2_0_0_beta\xerces.jar com.madhu.xml.SAXErrors <input-xml-file>
SAXEntity:
java -classpath ..;c:\xerces-2_0_0_beta\xerces.jar com.madhu.xml.SAXEntity <input-xml-file>
SAXLexical:
java -classpath ..;c:\xerces-2_0_0_beta\xerces.jar com.madhu.xml.SAXLexical <input-xml-file>
There are rules in the Makefile for executing each app as well. Inspect the Makefile for details.
How do I compile and test the Spider example?
First, change directories to the Spider directory. You can compile the source code using this command:
javac -d .. -classpath ..;c:\hex\lib\classes.zip *.java
This assumes you have downloaded and installed HEX into c:\hex. If you download a different version or install HEX in a different directory, adjust the path to classes.zip appropriately in the command above. This will compile all source code in the current directory and place all compiled class files one directory up. The default rule in the supplied Makefile does the same thing.
The example can executed from the source directory using this command:
java -classpath ..;c:\hex\lib\classes.zip com.madhu.spider.Spider <# of states> <data-output-file>
This example will go out the Internet to retrieve data from the US Census web site and save it in the output file specified in the command above. Execution time is dependent on how many states you want process and the speed of your Internet connection.