blob: 46abf41c796725804d8d9bd4e0179dfede5aa8b8 [file] [log] [blame]
<?xml version="1.0" standalone="no"?>
<!DOCTYPE s1 SYSTEM "sbk:/style/dtd/document.dtd">
<s1 title="&XercesCName; Samples">
<s2 title="Building the Samples">
<p>&XercesCName; comes packaged with ten 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.</p>
<p>Once you have set up your PATH variable, you can run the
samples by opening a command window (or your shell prompt for
UNIX environments). Sample XML data files are provided in the
samples/data directory.</p>
<p>The installation process for the samples is same on all UNIX
platforms.
Note that <em>runConfigure</em> is just a helper script and you are free to
use <em>./configure</em> with the correct parameters to make it work
on any platform-compiler combination of your choice. The script needs the following parameters:
</p>
<source>Usage: runConfigure "options"
where options may be any of the following:
-p &lt;platform&gt; (accepts 'aix', 'linux', 'solaris', 'hp-10', 'hp-11')
-c &lt;C compiler name&gt; (e.g. gcc, xlc_r, cc or aCC)
-x &lt;C++ compiler name&gt; (e.g. g++, xlC_r, CC or aCC)
-d (specifies that you want to build debug version)
-h (get help on the above commands)</source>
<note><em>NOTE:</em>The code samples in this section assume that you are are working on the Linux binary drop.
If you are using some other UNIX flavor, please replace '-linux' with the appropriate
platform name in the code samples.</note>
</s2>
<s2 title="Running the Samples">
<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>&#160;</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 Validator.</li>
<li><link idref="createdoc">CreateDOMDocument</link>
<br/>CreateDOMDocument creates a DOM tree in memory from scratch.</li>
</ul>
</s3>
</s2>
</s1>