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

PParse
 

PParse demonstrates progressive parsing.

In this example, the programmer doesn't have to depend upon throwing an exception to terminate the parsing operation. Calling parseFirst() will cause the DTD to be parsed (both internal and external subsets) and any pre-content, i.e. everything up to but not including the root element. Subsequent calls to parseNext() will cause one more piece of markup to be parsed, and spit out from the core scanning code to the parser. You can quit the parse any time by just not calling parseNext() anymore and breaking out of the loop. When you call parseNext() and the end of the root element is the next piece of markup, the parser will continue on to the end of the file and return false, to let you know that the parse is done.

Building on Windows
 

Load the xerces-c-1_1_0win32\samples\Projects\Win32\VC6\samples.dsw Microsoft Visual C++ workspace inside your MSVC IDE. Then build the project marked PParse.


Building on UNIX
 
cd xerces-c-1_1_0-linux/samples
./runConfigure -p<platform> -c<C_compiler> -x<C++_compiler>
cd PParse
gmake

This will create the object files in the current directory and the executable named PParse in ' xerces-c-1_1_0-linux/bin' directory.

To delete all the generated object files and executables, type

gmake clean

Running PParse
 

The program looks for the first 16 elements of the XML file, and reports if successful.

PParse [-v] <XML file>

The output is the following:

Got the required 16 elements.



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