note 89853 added to class.xmlreader

From: Date: Wed, 25 Mar 2009 23:16:58 +0000
Subject: note 89853 added to class.xmlreader
Groups: php.notes 
Request: Send a blank email to php-notes+get-152454@lists.php.net to get a copy of this message
The "XML2Assoc" functions noted here should be used with caution... basically they are duplicating the functionality already present in SimpleXML. They may work but they won't scale. Their are two main uses cases for parsing XML, each suited to either XMLReader or SimpleXML. 1. SimpleXML is an excellent tool for easy access to an XML document tree using native PHP data types. It starts to flounder with massive (> 50M or so) XML documents, as it reads the entire document into memory before it can be processed. SimpleXML will just laugh at you then die when your server runs out of memory (or it will cause a load spike). 2. Aside from the reasoning behind massive XML documents, if you have to deal with massive XML documents, use XMLReader to process them. Don't try and gather an entire XML document into a PHP data structure using XMLReader and a PHP xml2assoc() function, you are reinventing the SimpleXML wheel. When parsing massive XML documents using XMLReader, gather the data you need to perform an operation then perform it before skipping to the next node. Do not build massive data structures from a massive XML document, your server (and it's admins) will not like you. ---- Server IP: 117.104.160.194 Probable Submitter: 58.6.148.157 ---- Manual Page -- http://www.php.net/manual/en/class.xmlreader.php Edit -- https://master.php.net/note/edit/89853 Del: integrated -- https://master.php.net/note/delete/89853/integrated Del: useless -- https://master.php.net/note/delete/89853/useless Del: bad code -- https://master.php.net/note/delete/89853/bad+code Del: spam -- https://master.php.net/note/delete/89853/spam Del: non-english -- https://master.php.net/note/delete/89853/non-english Del: in docs -- https://master.php.net/note/delete/89853/in+docs Del: other reasons-- https://master.php.net/note/delete/89853 Reject -- https://master.php.net/note/reject/89853 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#152454) next »