| <?xml version="1.0" standalone="no"?> |
| <!DOCTYPE s1 SYSTEM "./dtd/document.dtd"> |
| |
| <s1 title="TreeViewer Sample"> |
| <s2 title="Running TreeViewer"> |
| <p><code>TreeViewer</code> 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. </p> |
| <p>Requirements:</p> |
| <ul> |
| <li>&javaparsername; is loaded on your computer.</li> |
| <li>Either:</li> |
| <ul><li>JDK 1.1.8 and Swing1.1.1 are is loaded on your computer.</li></ul> |
| <li>Or:</li> |
| <ul><li>Java 2 (jdk1.2.2) is loaded on your computer.</li></ul> |
| </ul> |
| <p>Source code: </p> |
| <ul> |
| <li>TreeViewer.java</li> |
| <li>TreeView.java</li> |
| <li>DOMTree.java</li> |
| <li>DefaultImages.java</li> |
| </ul> |
| </s2> |
| |
| <s2 title="TreeViewer"> |
| <p><em>To run TreeViewer:</em></p> |
| <ol> |
| <li>open up a MS-DOS command line window</li> |
| <li>set the path to the jdk\bin directory</li> |
| <li>change directory to the latest &javaparserdirectory; directory</li> |
| <li>invoke the <code>TreeViewer</code> sample</li> |
| </ol> |
| |
| <p><em>On Windows:</em></p> |
| <p>The easiest way to do this is to create a .bat file using the |
| Notepad editor. Then <code>TreeViewer</code> can be invoked by double clicking |
| on the file name or icon. The following command lines assume that |
| both the jdk and the &javaparserdirectory; directories are located directly below |
| the c: drive.</p> |
| |
| <p><em>With jdk1.1.8:</em></p> |
| <source>set PATH=%PATH%;c:\jdk1.1.8\bin |
| set CLASSPATH=%CLASSPATH%;c:\&javaparserdirectory;\xerces.jar;c:\&javaparserdirectory;\xercesSamples.jar |
| set CLASSPATH=%CLASSPATH%;c:\Swing-1.1.1\swingall.jar |
| cd c:\&javaparserdirectory; |
| java ui.TreeViewer data/personal.xml</source> |
| |
| <p><em>With jdk1.2.2:</em></p> |
| <p>Swing is included in the Java 2 release and it doesn't required |
| a separate reference. </p> |
| <source>set PATH=%PATH%;c:\jdk1.2.2\bin |
| set CLASSPATH=%CLASSPATH%;c:\&javaparserdirectory;\xerces.jar;c:\&javaparserdirectory;\xercesSamples.jar |
| cd c:\&javaparserdirectory; |
| java ui.TreeViewer data/personal.xml</source> |
| |
| <note>Parse your own XML file instead of data/personal.xml</note> |
| </s2> |
| </s1> |