nestable C/C++ parser

Paul Miller stele at
Thu Dec 9 21:26:45 GMT 1999

> I think your original request got lost in a side track.  If is very possible
> to do what you want with expat.  The trick is the use of the XML_SetUserData
> and the userdata argument.  Basically, the trick is to create a base class
> that has methods that you want to change the behavior of (typically,
> StartElement and EndElement).  Create derived classes for each different
> behavior that you want.  Call XML_SetUserData to the initial handler object.
> In your StartElement callback, cast the userdata argument up to a pointer to
> your base class and call its startElement virtual method.  If you want to
> change the handler, make another call to XML_SetUserData.

The problem here is it requires 3 callbacks to parse a single element
and restore the state. I'd like a cleaner solution.

Paul Miller - stele at

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list