Running TreeViewer

 

TreeViewer displays the input file in a graphical tree based interface. This sample highlights the error handling capabilities of the parser, demonstrating how the parser can recover from many types of common errors. 

Source code:

Requirements:

  • XML4J is loaded on your computer
  • Either
    • JDK 1.1.8  is loaded on your computer
    • Swing1.1.1  is loaded on your computer
  • Or
    • Java 2 (jdk1.2.2)  is loaded on your computer

TreeViewer

 

To run TreeViewer:

  1. open up a msdos command line window
  2. set the path to the jdk\bin directory
  3. change directory to the latest xml4j directory
  4. invoke the TreeViewer parser

On Windows:

The easiest way to do this is to create a .bat file using the Notepad editor. Then the SAXWriter can be invoked by double clicking on the file name or icon. The following command lines assume that both the jdk and the xml4j directories are located directly below the c: dirve.

With jdk1.1.8:

set path=c:\jdk1.1.8\bin;%PATH%
set classpath=c:\xml4j_2_0_13\xml4j.jar;%CLASSPATH%;
set classpath=c:\xml4j_2_0_13\xml4jSamples.jar;%CLASSPATH%;
set classpath=c:\Swing-1.1.1\swingall.jar;%CLASSPATH%;
cd c:\xml4j_2_0_13
java ui.TreeViewer data\personal.xml

With jdk1.2.2

Swing is included in the Java 2 release and it doesn't required a separate reference.

set path=c:\jdk1.2.2\bin;%PATH%
set classpath=c:\xml4j_2_0_13\xml4j.jar;%CLASSPATH%;
set classpath=c:\xml4j_2_0_13\xml4jSamples.jar;%CLASSPATH%;
cd c:\xml4j_2_0_13
java ui.TreeViewer data\personal.xml

Note: Parse your own XML file instead of data\personal.xml

Return to Parsers