SAX and classes
| From: | Bobo Wieland | Date: | Mon, 21 Apr 2003 08:57:07 +0000 |
| Subject: | SAX and classes | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-19525@lists.php.net to get a copy of this message | ||
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