xml_set_object() ?!?
| From: | Regenfeld | Date: | Sun, 05 Aug 2001 19:55:25 +0000 |
| Subject: | xml_set_object() ?!? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-61347@lists.php.net to get a copy of this message | ||
Why is that not working:
class XML {
var $parser;
var $Dummy;
function XML() {
$this->parser = xml_parser_create();
xml_set_object($this->parser,&$this);
xml_set_element_handler($this->parser,"tag_open","tag_close");
}
function getDummy() {
echo $this->Dummy;
}
function parseFile($uri) {
$fp = fopen($uri, "r");
$string = fread($fp, 4096);
fclose($fp);
xml_parse($this->parser,$string)
}
function tag_open($parser,$name,$attrs) {
if ($name == "DummyElement") {
$this->Dummy = $attrs['DummyAttribute'];
}
}
function tag_close($parser,$name) {}
}
$main = new XML();
$main->parseFile(dummy.xml);
$main->getDummy();
$Dummy is correctly set, but cannot be accessed via the method 'getDummy()' :-(