[Expat-discuss] expat in C++

allan.saywitz at pb.com allan.saywitz at pb.com
Wed May 21 10:53:17 EDT 2003





There are lots of c++ wrappers for expat on the web, just do a google
search on expat C++ Wrapper.  Here is two:

http://www.codeproject.com/soap/expatimpl.asp
http://www.oofile.com.au/xml/expatpp.html

I actually wrote my own since we are doing c++ for vse if you can belive
that!  Using inheritance worked well for me.  I wrote a c++ expat wrapper
to be used as a base class.  This base class has virtual functions for all
the different events I want to respond to.  So now all I have to do is
inherit from my base class and voila, I have a c++ class that reads xml and
functions for handling start tag, end tag, char data, etc...

Expat is so cool you can easily write all kinds of wrapper classes to fit
your needs!

Here is some sample code.

thanks

allan

(See attached file: XMLExpatParser.h)(See attached file:
XMLExpatParser.cpp)





                                                                                                                                             
                      "Gururajan, Subhashini                                                                                                 
                      (Cognizant)"                   To:       <expat-discuss at libexpat.org>                                                  
                      <GSubhash at chn.cognizant        cc:                                                                                     
                      .com>                          Subject:  [Expat-discuss] expat in C++                                                  
                      Sent by:                                                                                                               
                      expat-discuss-bounces at l                                                                                                
                      ibexpat.org                                                                                                            
                                                                                                                                             
                                                                                                                                             
                      05/21/2003 12:30 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.

Thanks & Regards,

SUBHASHINI

(See attached file: InterScan_Disclaimer.txt)
_______________________________________________
Expat-discuss mailing list
Expat-discuss at libexpat.org
http://mail.libexpat.org/mailman/listinfo/expat-discuss

-------------- next part --------------
A non-text attachment was scrubbed...
Name: XMLExpatParser.h
Type: application/octet-stream
Size: 5623 bytes
Desc: not available
Url : http://mail.libexpat.org/pipermail/expat-discuss/attachments/20030521/b726a4d5/XMLExpatParser-0002.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: XMLExpatParser.cpp
Type: application/octet-stream
Size: 7482 bytes
Desc: not available
Url : http://mail.libexpat.org/pipermail/expat-discuss/attachments/20030521/b726a4d5/XMLExpatParser-0003.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: InterScan_Disclaimer.txt
Type: application/octet-stream
Size: 524 bytes
Desc: not available
Url : http://mail.libexpat.org/pipermail/expat-discuss/attachments/20030521/b726a4d5/InterScan_Disclaimer-0001.obj


More information about the Expat-discuss mailing list