Skip to content
Snippets Groups Projects
samples.xml 3.84 KiB
Newer Older
<!DOCTYPE s1 SYSTEM "sbk:/style/dtd/document.dtd">
Tinny Ng's avatar
Tinny Ng committed
    <s2 title="Introduction">
    <p>&XercesCName; comes packaged with 13 sample applications that
    demonstrate salient features of the parser using simple
    applications written on top of the SAX and DOM APIs provided by
    the parser.  Sample XML data files are provided in the samples/data directory.</p>
Tinny Ng's avatar
Tinny Ng committed
    </s2>
    <s2 title="Building the Samples">
        <p>Please refer to the <jump href="build.html">Build Page</jump> for
           Build Instructions as per specific platform.</p>
    <p>The sample applications are dependent on the &XercesCName; shared library
		(and could also depend on the ICU library if you built &XercesCName; with ICU).
		Therefore, on Windows platforms you must make sure that your <code>PATH</code>
		environment variable is set properly to pick up these shared libraries at
		runtime.</p>

		<p>On UNIX platforms you must ensure that <ref>LIBPATH</ref>
		environment variable is set properly to pick up the shared libraries at
		runtime. (UNIX gurus will understand here that <ref>LIBPATH</ref> actually
		translates to <em>LD_LIBRARY_PATH</em> on Solaris and Linux, <em>SHLIB_PATH</em> on HP-UX
		and stays as <em>LIBPATH</em> on AIX).</p>

		<p>To set you LIBPATH (on AIX for example), you would type:</p>
<source>export LIBPATH=&XercesCInstallDir;/lib:$LIBPATH</source>
               <p>On both Windows and UNIX platforms, if the parser is built with icu message loader
               (like IBM XML4C binaries), or message catalog loader, then you need to set another environment
               variable, XERCESC_NLS_HOME to point to the directory, $XERCESCROOT/msg, where the message
               files reside.              
PeiYong Zhang's avatar
PeiYong Zhang committed
               </p>
<source>
set XERCESC_NLS_HOME=$XERCESCROOT\msg
export XERCESC_NLS_HOME=$XERCESCROOT/msg
setenv XERCESC_NLS_HOME=$XERCESCROOT/msg
PeiYong Zhang's avatar
PeiYong Zhang committed
</source>
               
               <p>Once you have set up the environment variables, you can run the
               samples by opening a command window (or your shell prompt for
               UNIX environments).</p>

		<s3 title="&XercesCName; Samples">
			<ul>
				<li><link idref="saxcount">SAXCount</link>
					<br/>SAXCount counts the elements, attributes, spaces and
					characters in an XML file.</li>
				<li><link idref="saxprint">SAXPrint</link>
					<br/>SAXPrint parses an XML file and prints it out.</li>
				<li><link idref="domcount">DOMCount</link>
					<br/>DOMCount counts the elements in a XML file.</li>
				<li><link idref="domprint">DOMPrint</link>
					<br/>DOMPrint parses an XML file and prints it out.</li>
				<li><link idref="memparse">MemParse</link>
					<br/>MemParse parses XML in a memory buffer, outputing the number of elements and attributes.</li>
				<li><link idref="redirect">Redirect</link>
					<br/>Redirect redirects the input stream for external entities.</li>
				<li><link idref="pparse">PParse</link>
					<br/>PParse demonstrates progressive parsing.</li>
				<li><link idref="stdinparse">StdInParse</link>
					<br/>StdInParse demonstrates streaming XML data from standard input.</li>
				<li><link idref="enumval">EnumVal</link>
					<br/>EnumVal shows how to enumerate the markup decls in a DTD Grammar.</li>
PeiYong Zhang's avatar
PeiYong Zhang committed
				<li><link idref="senumval">SEnumVal</link>
					<br/>SEnumVal shows how to enumerate the markup decls in a Schema Grammar.</li>
				<li><link idref="createdoc">CreateDOMDocument</link>
					<br/>CreateDOMDocument creates a DOM tree in memory from scratch.</li>
Khaled Noaman's avatar
Khaled Noaman committed
				<li><link idref="sax2count">SAX2Count</link>
					<br/>SAX2Count counts the elements, attributes, spaces and
					characters in an XML file.</li>
				<li><link idref="sax2print">SAX2Print</link>
					<br/>SAX2Print parses an XML file and prints it out.</li>