note 78835 rejected from function.xml-set-element-handler by nlopess

From: Date: Wed, 31 Oct 2007 21:25:18 +0000
Subject: note 78835 rejected from function.xml-set-element-handler by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-131891@lists.php.net to get a copy of this message
Note Submitter: stephen dot bungert at hotmail dot de ---- Every example of an XML parser that I've seen uses global variables to stor the parsed data in. So that it can be manipulated later. How can you do this when register_globals is turned off? Can you pass variables to the callback functions? If so how An example: ... function dataHandler($currentParser, $data) { global $dataCount; global $parsedData; global $currentTag; global $xmlElements; // Return if $currentTag is empty if ($currentTag == '') { return; } // Otherwise put data in the array for later use if (ENDER_TAG == "user") { if ($currentTag == "USERNAME") { $parsedData[$dataCount][$xmlElements[0]] = $data; } ... the content of the xml file is stored in the array $parsedData. But this is accessed through the use of global. How can I store the parsed data in $parsedData, for example, when globals doesn't work?

« previous php.notes (#131891) next »