[Expat-discuss] XMLParse Handlers

Karl Waclawek karl@waclawek.net
Sun Nov 3 05:07:53 2002


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