Samples

| Introduction |
| DOMCount SAXCount DOMWriter SAXWriter DOMFilter IteratorView TreeWalker TreeViewer
| Caveats |
| Xerces-J: Running the sample applications requires that you have already loaded the Xerces-J software on your computer.
| Java: Running the sample applications require that your computer has a correctly installed JDK. If you do not already have a JDK already on your computer download one from Sun's Java website: http://java.sun.com or from IBM's website http://www.ibm.com/developer/java/ where you can find an "Enhanced Windows JDK" that is optimized for the Windows platform. The sample applications described in the following pages support Java 1 - JDK 1.1.6. 1.1.7, 1.1.8 or Java 2 - JDK 1.2.2.
| UNIX: Command lines in the pages linked below use the Windows path separator ';' (semicolon) and directory separator '\' (backslash).. On UNIX, use the ':' (colon) character to separate the JAR files in the classpath, and replace Windows directory separator '\' (backslash) with '/' (forward slash).
| DOMCount Sample |
| DOMCount parses your input file, and outputs the total parse time, along with counts of elements, attributes, text characters, and ignorable whitespace characters. DOMCount displays errors and warnings that occur during parsing.
| SAXCount Sample |
| SAXCount parses your input file, and outputs the total parse time, along with counts of elements, attributes, text characters, and ignorable whitespace characters. SAXCount displays errors and warnings that occur during parsing.
| DOMWriter Sample |
| DOMWriter parses a file, and prints it out in XML format. The command line option, -c, is used to print files in "canonical" XML format, so that two XML documents can be compared. They also display any errors or warnings that occurred during the parse. DOMWriter also provides a feature to set the output Java encoding through the -e switch.
| SAXWriter Sample |
| SAXWriter parses a file, and prints it out in XML format. The command line option, -c, is used to print files in "canonical" XML format, so that two XML documents can be compared. They also display any errors or warnings that occurred during the parse.
| DOMFilter Sample |
| DOMFilter shows you how to search for specific elements in your XML document. It uses `getElementsByTagName()` to traverse the DOM tree, looking for elements or attributes that match your specification.
| IteratorView Sample |
| IteratorView is an interactive UI sample that displays the DOM tree. It shows the progress of the iteration by moving the selection within the DOM tree. Buttons act as a control panel, allowing the user to interactively iterate through the tree, remove nodes, add nodes, and view the results immediately in the tree. The `IteratorView` uses an example filter, `NameNodeFilter`, that can be controlled from the UI and a `DOMTreeFull` class that displays the full DOM tree with all the nodes.
| TreeWalker Sample |
| TreeWalkerviewView is an interactive UI sample that displays the DOM tree. It show the progress of the tree traversal by moving the selection within the DOM tree. Buttons act as a control panel, allowing the user to interactively traverse the tree, remove nodes, add nodes, and view the results immediately in the tree. The `TreeWalkerviewView` uses an example filter, `NameNodeFilter`, that can be controlled from the UI and a `DOMTreeFull` class that displays the full DOM tree with all the nodes.
| Treeviewer Sample |
| TreeViewer displays the input XML file in a graphical tree-style interface. It will also highlight lines have well-formedness or validation errors.

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