<?xml version="1.0" standalone="no"?>
<!DOCTYPE s1 SYSTEM "./dtd/document.dtd">

<s1 title="SAX/DOMCount Samples">
	<s2 title="Running SAXCount and DOMCount">
		<p>SAXCount and DOMCount invoke the parser 
		on an XML document, and print out information about the 
		document. By default, SAXCount creates a non-validating 
		SAX parser and DOMCount creates a validating DOM parser. 
		They both count the number of elements, attributes, text characters, 
		and ignorable whitespace characters in the document and display the 
		amount of time it takes to complete the task. </p>
		<p>The command lines below expect 
		the current directory to be the directory containing the JAR file.</p>
		<p>Requirements:</p>
		<ul>
			<li>&javaparsername; is loaded on your computer.</li>
			<li>JDK is loaded on your computer.</li>
		</ul>
		<p>Source code: </p>
		<ul>
			<li>SAXCount.java</li>
			<li>DOMCount.java</li>
		</ul>
	</s2>

	<s2 title="SAXCount">
		<p><em>To run SAXCount:</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>SAXCount</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 the <code>SAXCount</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>
<source>set PATH=%PATH%;c:\jdk1.1.8\bin
set CLASSPATH=%CLASSPATH%;c:\&javaparserdirectory;\xerces.jar;c:\&javaparserdirectory;\xercesSamples.jar
cd c:\&javaparserdirectory;
java sax.SAXCount data/personal.xml</source>

		<p><em>Switches:</em></p>
		<p>SAXCount also allows you to change the default behavior using the 
		following command line flags: </p>
		<ul>
			<li>-p Specify the parser class to be used.
			<br/>The available parsers are:</li>
			<ul>
				<li>org.apache.xerces.parsers.SAXParser [default parser]</li>
			</ul>
			<li>-h Print SAXCount help information. [default is no help]</li>
			<li>-v Turn on validation</li>
		</ul>
		<p>Running SAXCount with the default settings is equivalent to 
		running SAXCount like this (type this in as one long command line): </p>
<source>java sax.SAXCount -p org.apache.xerces.parsers.SAXParser 
    data/personal.xml </source>
		<p>Bringing up the help information: </p>
<source>java sax.SAXCount -h </source>
		<note>Parse your own XML file instead of data/personal.xml</note>
	</s2>
	
	<s2 title="DOMCount">
		<p><em>To run DOMCount:</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>DOMCount</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 the <code>DOMCount</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: dirve.</p>
<source>set PATH=%PATH%;c:\jdk1.1.8\bin
set CLASSPATH=%CLASSPATH%;c:\&javaparserdirectory;\xerces.jar;c:\&javaparserdirectory;\xercesSamples.jar
cd c:\&javaparserdirectory;
java dom.DOMCount data/personal.xml</source>

		<p><em>Switches:</em></p>
		<p>DOMCount also allows you to change the default behavior via the 
		following command line flags: </p>
		<ul>
			<li>-p Specify the parser class to be used.
			<br/>The available parsers are:</li>
			<ul>
				<li>dom.wrappers.DOMParser [default parser]</li>
			</ul>
			<li>-h Print DOMCount help information. [default is no help]</li>
		</ul>
		<p>Running DOMCount with the default settings is equivalent to running 
		<code>DOMCount</code> like this (type this in as one long command line): </p>

<source>java dom.DOMCount -p dom.wrappers.DOMParser 
    data/personal.xml </source>
		<p>Bringing up the help information: </p>
<source>java dom.DOMCount -h</source>

		<note>Parse your own XML file instead of data/personal.xml</note>


	</s2>
</s1>
