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. Requirements:
Source code:
To run SAXCount:
On Windows: The easiest way to do this is to create a .bat file using the Notepad editor. Then the SAXCount can be invoked by double clicking on the file name or icon. The following command lines assume that both the jdk and the xml4j directories are located directly below the c: dirve. set path=c:\jdk1.1.8\bin;%PATH% Switches: SAXCount also allows you to change the default behavior via the following command line flags:
com.ibm.xml.parsers.SAXParser [default parser] com.ibm.xml.parsers.ValidatingSAXParser Running SAXCount with the default settings is equivalent to running SAXCount like this (type this in as one long command line): java sax.SAXCount -p com.ibm.xml.parsers.SAXParser Bringing up the help information: java sax.SAXCount -h Note: Parse your own XML file instead of data\personal.xml
To run DOMCount:
On Windows: The easiest way to do this is to create a .bat file using the Notepad editor. Then the DOMCount can be invoked by double clicking on the file name or icon. The following command lines assume that both the jdk and the xml4j directories are located directly below the c: dirve. set path=c:\jdk1.1.8\bin;%PATH% Switches: DOMCount also allows you to change the default behavior via the following command line flags (type this in as one long command line):
dom.wrappers.NonValidatingDOMParser dom.wrappers.DOMParser [default parser] dom.wrappers.TXParser Running DOMCount with the default settings is equivalent to running DOMCount like this: java dom.DOMCount -p dom.wrappers.DOMParser Bringing up the help information: java dom.DOMCount -h Note: Parse your own XML file instead of data\personal.xml |
|||