Re: SAX and classes
| From: | Bobo Wieland | Date: | Mon, 21 Apr 2003 09:01:39 +0000 |
| Subject: | Re: SAX and classes | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-19526@lists.php.net to get a copy of this message | ||
Forget it... I figured it out by doing what I should have from the begining:
reading the manual...
I just needed to add the following to my code:
<CODE>
xml_set_object($this->parser, &$this);
</CODE>
sorry...
.bobo
----- Original Message -----
From: "Bobo Wieland" <bobo.wieland@ektv.nu>
To: <php-windows@lists.php.net>
Sent: Monday, April 21, 2003 10:57 AM
Subject: [PHP-WIN] SAX and classes
> if I'm about to put all SAX-functions into a class how would I declare the
> element handler functions?
>
> <CODE>
>
> class ParseXML {
>
> var $parser;
>
> function ParseXML() {
> $this->parser = xml_parser_create("ISO-8859-1");
> xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING,
> false);
>
> /* HOW SHOULD I WRITE THE FOLLOWING, SO THAT THE
openTag()-FUNCTION
> IN
> ParseXML WILL BE CALLED?!? */
> xml_set_element_handler($this->parser, 'openTag', 'closeTag');
> xml_set_character_data_handler($this->parser, 'charData');
> }
>
> function openTag($parser, $name, $attribs) {
> switch($name) {
> case "rub": print("<h1>"); break;
> ...
> }
> }
> ...
> }
>
> </CODE>
>
>
> please help me with this one! =)
>
>
>
> .bobo
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>