SAXCount and DOMCount
are sample programs that can be used to invoke the parser on an XML document, and to print out interesting information about the XML document.. By default, invoking SAXCount will create a non-validating SAX parser, and will count the number of elements, attributes, text characters, and ignorable whitespace characters in the document. SAXCount also displays the amount of time it took to complete its entire task. The command lines below expect the current directory to be the directory containing the JAR file.
Source code:
To run SAXCount with the default settings, use the following command line (all on one line):
SAXCount also allows you to change the default behavior via the following command line flags:
- -p
Specify the parser class to be used. The available parsers are: com.ibm.xml.parsers.SAXParser [default parser]
com.ibm.xml.parsers.ValidatingSAXParser
- -h
Print SAXCount help information. [default is no help]
Running SAXCount with the default settings is equivalent to running SAXCount like this (type this in as one long command line):
To run DOMCount with the default settings, use the following command line (all on one line):
DOMCount also allows you to change the default behavior via the following command line flags:
- -p
Specify the parser class to be used. The available parsers are: dom.wrappers.NonValidatingDOMParser
dom.wrappers.DOMParser [default parser] dom.wrappers.TXParser
- -h
Print DOMCount help information. [default is no help]
Running DOMCount with the default settings is equivalent to running DOMCount like this (type this in as one long command line):
Return to Samples |