SAXCount

Building SAXCount

On Windows Platforms:

Load the <xml4c2InstallDir>\samples\Projects\Win32\VC6\samples. dsw Microsoft Visual C++ workspace inside your MSVC IDE. Then build the project marked SAXCount.

On UNIX (AIX, Solaris, HP-UX, Linux):

Make sure you have set your environment variable ROOTDIR to point to the top-most directory where you installed XML4C.

cd <xml4c2InstallDir>/samples/Projects/<platform>
make -f SAXCount.mak COMPILESWITCH="-w -O"

where <platform> is the platform you are working on. This will create the object files in the <xml4c2InstallDir> /bin/obj/SAXCount directory and the executable named saxcount in '<xml4c2InstallDir>/bin' directory. If the 'bin' or 'obj/SAXCount' directories do not exist then the build will fail. In that case you need to create the missing directory(s) under '<xml4c2InstallDir>' directory. To delete the object and executable files of SAXCount:

    cd <xml4c2InstallDir>/samples/Projects/<platform>
    make clean -f SAXCount.mak

This would delete all the object files (.o files) from your 'obj/SAXCount' sample directory and the executable from '<xml4c2InstallDir>/bin' directory.

Running SAXCount

The SAXCount sample parses an XML file and prints out a count of the number of elements in the file. To run SAXCount, enter the following

    saxcount <filename>

To use the validating parser, use

    saxcount -v <filename>

Here is a sample output from SAXCount

cd <xml4c2InstallDir>/samples/data
saxcount -v personal.xml
personal.xml: 60 ms (37 elems, 12 attrs, 134 spaces, 134 chars)

Running SAXCount with the validating parser gives a different result because ignorable white-space is counted separately from regular characters.

saxcount personal.xml
personal.xml: 10 ms (37 elems, 12 attrs, 0 spaces, 268 chars)

Note that the sum of spaces and chracters in both versions is the same.

Note: The time reported by the program may be different depending on your machine processor.
 

Copyright (c) IBM Corp. 1999, Center for Java Technology, Cupertino, USA