| 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.

Requirements:

- Xerces-J is loaded on your computer.
- Either:

- JDK 1.1.8 and Swing1.1.1 are is loaded on your computer.

- Or:

- Java 2 (jdk1.2.2) is loaded on your computer.

Source code:

- TreeViewer.java
- TreeView.java
- DOMTree.java
- DefaultImages.java

| TreeViewer |

To run TreeViewer:

1. open up a MS-DOS command line window
2. set the path to the jdk\bin directory
3. change directory to the latest xerces-1_4_4 directory
4. invoke the `TreeViewer` sample

On Windows:

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

With jdk1.1.8:

    set PATH=%PATH%;c:\jdk1.1.8\bin
    set CLASSPATH=%CLASSPATH%;c:\xerces-1_4_4\xerces.jar;c:\xerces-1_4_4\xercesSamples.jar
    set CLASSPATH=%CLASSPATH%;c:\Swing-1.1.1\swingall.jar
    cd c:\xerces-1_4_4
    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=%PATH%;c:\jdk1.2.2\bin
    set CLASSPATH=%CLASSPATH%;c:\xerces-1_4_4\xerces.jar;c:\xerces-1_4_4\xercesSamples.jar
    cd c:\xerces-1_4_4
    java ui.TreeViewer data/personal.xml

| Parse your own XML file instead of data/personal.xml

Copyright © 1999, 2000 The Apache Software Foundation. All Rights Reserved.