Re: $this in an XML data handler ... in a class
| From: | Clay Loveless | Date: | Wed, 03 Jul 2002 18:05:34 +0000 |
| Subject: | Re: $this in an XML data handler ... in a class | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-105255@lists.php.net to get a copy of this message | ||
Actually, a careful reading of the docs reveals the following at the bottom
of each xml_set_*_handler section:
"Note: Instead of a function name, an array containing an object reference
and a method name can also be supplied."
-Clay
> From: Analysis & Solutions <danielc@analysisandsolutions.com>
> Date: Wed, 3 Jul 2002 13:14:34 -0400
> To: PHP List <php-general@lists.php.net>
> Subject: Re: [PHP] $this in an XML data handler ... in a class
>
> Clay:
>
> On Wed, Jul 03, 2002 at 02:20:56AM -0700, Clay Loveless wrote:
>>
>> xml_set_element_handler(
>> $this->xmlparser,
>> array($this,"_xml_start_element"),
>> array($this,"_xml_end_element"));
>> xml_set_character_data_handler(
>> $this->xmlparser,
>> array($this,"_xml_character_data"));
>
> Without getting into all of the other potential issues in your code, allow
> me to quickly point out that the function name parameters to the
> set_*_handler() are supposed to be strings. The string is to be the name
> of the function. So, for example, do this:
>
> xml_set_character_data_handler($this->xmlparser, '_xml_character_data');
>
> Now, I'm not guaranteeing this will cause the function to become part of
> the class, but at least the function will be properly initiated.
>
> --Dan