[Expat-discuss] XMLParse Handlers

Karl Waclawek karl@waclawek.net
Sun Nov 3 07:21:39 2002


Well, Expat is written in C which does not support OO that well.
However, there are OO wrappers for Expat if that is what you prefer.
Check out the links at http://www.libexpat.org.

Karl

----- Original Message ----- 
From: "Kevin" <kevin@myplaceonline.com>
To: "'Karl Waclawek'" <karl@waclawek.net>; <expat-discuss@libexpat.org>
Sent: Sunday, November 03, 2002 1:22 AM
Subject: RE: [Expat-discuss] XMLParse Handlers


> So is there anyway around this, or is event handling just inherently
> anti-object oriented?
> 
> Thanks again,
> Kevin
> 
> -----Original Message-----
> From: Karl Waclawek [mailto:karl@waclawek.net] 
> Sent: Sunday, November 03, 2002 12:08 AM
> To: kevin@myplaceonline.com; expat-discuss@libexpat.org
> Subject: Re: [Expat-discuss] XMLParse Handlers
> 
> Yes, the handlers you have to set with Expat must be clean
> function pointers. Member methods are not compatible, since
> they have a hidden *this* parameter.
> 
> Static methods should be OK, but I am no C++ expert.
> 
> Karl
> 
> ----- Original Message ----- 
> From: "Kevin" <kevin@myplaceonline.com>
> To: <expat-discuss@libexpat.org>
> Sent: Saturday, November 02, 2002 10:57 PM
> Subject: [Expat-discuss] XMLParse Handlers
> 
> 
> > I am having a problem with Expat.  I think the problem is the fact
> that
> > I am trying to implement it within a class.  Maybe not.  Here is the
> > error:
> > 
> >  
> > 
> > textdb.cpp:65: no matches converting function `elementStart' to type 
> > 
> > `void (*) (void *, const XML_Char *, const XML_Char **)'
> > 
> > textdb.h:31: candidates are: void textdb::TextDB::elementStart (void
> *, 
> > 
> > const char *, const char **)
> > 
> >  
> > 
> > here is the line it is complaining about, followed by the elementStart
> > and elementEnd methods, which are class member methods:
> > 
> >  
> > 
> > XML_SetElementHandler(parser, elementStart, elementEnd);
> > 
> >  
> > 
> > void TextDB::elementStart(void *data, const char *el, const char
> **attr)
> > {
> > 
> >       printf("EL: %s\n",el);
> > 
> > }
> > 
> >  
> > 
> > void TextDB::elementEnd(void *data, const char *el) {
> > 
> > }
> > 
> >  
> > 
> > What's wrong?
> > 
> >  
> > 
> > Thanks,
> > 
> > Kevin
> > 
> >  
> > 
> >  
> > 
> > _______________________________________________
> > Expat-discuss mailing list
> > Expat-discuss@libexpat.org
> > http://mail.libexpat.org/mailman/listinfo/expat-discuss
> 
>