note 78835 added to function.xml-set-element-handler

From: Date: Tue, 30 Oct 2007 12:27:18 +0000
Subject: note 78835 added to function.xml-set-element-handler
Groups: php.notes 
Request: Send a blank email to php-notes+get-131826@lists.php.net to get a copy of this message
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? ---- Server IP: 87.124.64.96 Probable Submitter: 217.110.40.130 ---- Manual Page -- http://www.php.net/manual/en/function.xml-set-element-handler.php Edit -- https://master.php.net/note/edit/78835 Del: integrated -- https://master.php.net/note/delete/78835/integrated Del: useless -- https://master.php.net/note/delete/78835/useless Del: bad code -- https://master.php.net/note/delete/78835/bad+code Del: spam -- https://master.php.net/note/delete/78835/spam Del: non-english -- https://master.php.net/note/delete/78835/non-english Del: in docs -- https://master.php.net/note/delete/78835/in+docs Del: other reasons-- https://master.php.net/note/delete/78835 Reject -- https://master.php.net/note/reject/78835 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#131826) next »