MemParse

Building MemParse

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 MemParse.

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 MemParse.mak COMPILESWITCH="-w -O"

where <platform> is the platform you are working onThis will create the object files in the <xml4c2InstallDir>/bin/obj/MemParse directory and the executable named MemParse in '<xml4c2InstallDir>/bin' directory. If the 'bin' or 'obj/MemParse' 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 MemParse

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

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

Running MemParse

This program uses the Validating SAX Parser to parse a memory buffer containing XML statements, and reports the number of elements and attributes found.

    memparse [-nv]

The -nv option is used to invoke the NonValidating SAX Parser instead.

When invoked without any arguments:

    cd <xml4c2InstallDir>/samples/data
    memparse

The output is the following:

Finished parsing the memory buffer containing the following XML statements:

<?xml version='1.0' encoding='ascii'?>
<!DOCTYPE company [
<!ELEMENT company     (product,category,developedAt)>
<!ELEMENT product     (#PCDATA)>
<!ELEMENT category    (#PCDATA)>
<!ATTLIST category idea CDATA #IMPLIED>
<!ELEMENT developedAt (#PCDATA)>
]>


<company>
    <product>XML4C</product>
    <category idea='great'>XML Parsing Tools</category>
    <developedAt>
      IBM Center for Java Technology, Silicon Valley, Cupertino, CA
    </developedAt>
</company>


Parsing took 0 ms (4 elements, 1 attributes, 16 spaces, 95 characters).

You can also invoke it with '-nv' parameter to turn off validation.
 

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