note 15075 added to function.xml-set-object.php

From: Date: Mon, 27 Aug 2001 14:15:04 +0000
Subject: note 15075 added to function.xml-set-object.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-17205@lists.php.net to get a copy of this message
<p>in reply to jon9mm's question, I have found the same problem (function 'startElement' does not exist). I finally found the way around this, by re-reading this doc for xml_set_object. You HAVE to use the xml_set_object($this->parser, &$this) within your parser function.</p> <p>When that function is called, your object temporarily becomes the parser object and shares scope (so it can see 'startElement', etc). Once that function is done, the xml_set_object(...) call goes out of scope, and your object is no longer bound to the parser. So the simplist solution is to call xml_set_object(...), do any parsing, and then call xml_parser_free(...) all within the same function.</p> <p>And remember, don't call xml_set_object(...) in your object's constructor - your object will be forever bound to the parser object and you'll loose all access to your object's member functions.</p> <p>This is all explained in the examples above, but it took me reading it a couple of times to grok how it all works.</p> http://www.php.net/manual/en/function.xml-set-object.php

« previous php.notes (#17205) next »