[Expat-discuss] expat in C++

Karl Waclawek karl at waclawek.net
Wed May 21 09:56:58 EDT 2003


----- Original Message ----- 
From: "Gururajan, Subhashini (Cognizant)" <GSubhash at chn.cognizant.com>
To: <expat-discuss at libexpat.org>
Sent: Wednesday, May 21, 2003 1:37 AM

> Hi,
> I want to use expat for my C++ implementation. My objective is just to parse the XML file.
> The start, end and character data handlers are implemented as methods of a class.
> Now, I cant use the expat directly as, the function pointer forces me to include the class name
while declaring.
> So, the start handler declaration in expat.h should include the class name where the start handler
is actually
> implemented. How do I tackle this. Please help me out.
>

There are a few options:

You could use global functions as handlers, and pass the object reference
through the userData parameter. The function will then use this reference
to call the actual class method.

Or, you could use one of the C++ wrappers, like Arabica.
Check out the links on http://www.libexpat.org/#wrappers.

Karl




More information about the Expat-discuss mailing list