|
|
XML4J comes packaged with several sample applications that demonstrate features of the parser using the SAX and DOM APIs. The code is written in a tutorial style, to help you understand how to perform common tasks using
these API's. NOTE:
Command lines in the pages linked below use the Windows path separator ';' (semicolon). On UNIX, use the ':' (colon) character to separate the JAR files in the classpath, and replace Windows directory separators '\' (backslash) with '/' (forward slash).
|
 |
 |
|
|
SAXWriter and DOMWriter parse your input file, and print it out again in XML format. A command line option can be used to cause these samples to print in a "canonical" XML format, that can be used to compare XML documents. SAXWriter and DOMWriter also display any errors or warnings that occurred during the parse.
SAXWriter uses either the validating or non-validating SAX parser, while DOMWriter uses either the validating or non-validating DOM parser. |
|
|
SAXCount and DOMCount parse your input file, and output the total parse time, along with counts of elements, attributes, text characters, and ignorable whitespace characters. SAXCount and DOMCount also display any errors or warnings that occurred during the parse.
SAXCount uses either the validating or non-validating SAX parser, while the DOMCount uses either the validating or non-validating DOM parser. |
|
|
TreeViewer displays the input XML file in a graphical tree-style interface. It will also highlight lines have well-formedness or validation errors. |
|
|
|
|
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. |
|