http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Installation
Build

Downloads

API Docs
Samples
Programming
Migration
FAQs

Releases
Caveats
Feedback

Building the Samples
 

Xerces-C 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.

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.

The installation process for the samples is same on all UNIX platforms. Note that runConfigure is just a helper script and you are free to use ./configure with the correct parameters to make it work on any platform-compiler combination of your choice. The script needs the following parameters:

Usage: runConfigure "options"
       where options may be any of the following:
       -p <platform> (accepts 'aix', 'linux', 'solaris', 'hp-10', 'hp-11')
       -c <C compiler name> (e.g. gcc, xlc_r, cc or aCC)
       -x <C++ compiler name> (e.g. g++, xlC_r, CC or aCC)
       -d (specifies that you want to build debug version)
       -h (get help on the above commands)
NoteNOTE: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.

Running the Samples
 

The sample applications are dependent on the Xerces-C shared library (and could also depend on the ICU library if you built Xerces-C with ICU). Therefore, on Windows platforms you must make sure that your PATH environment variable is set properly to pick up these shared libraries at runtime.

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

To set you LIBPATH (on AIX for example), you would type:

export LIBPATH=xerces-c-1_1_0/lib:$LIBPATH

 

Xerces-C Samples
 
  • SAXCount
    SAXCount counts the elements, attributes, spaces and characters in an XML file.
  • SAXPrint
    SAXPrint parses an XML file and prints it out.
  • DOMCount
    DOMCount counts the elements in a XML file.
  • DOMPrint
    DOMPrint parses an XML file and prints it out.
  • MemParse
    MemParse parses XML in a memory buffer, outputing the number of elements and attributes.
  • Redirect
    Redirect redirects the input stream for external entities.
  • PParse
    PParse demonstrates progressive parsing.
  • StdInParse
    StdInParse demonstrates streaming XML data from standard input.
  • EnumVal
    EnumVal shows how to enumerate the markup decls in a DTD Validator.
  • CreateDOMDocument
    CreateDOMDocument creates a DOM tree in memory from scratch.



Copyright © 2000 The Apache Software Foundation. All Rights Reserved.