note 66226 added to function.domxml-open-file
| From: | (info@a-wing.co.uk) | Date: | Wed, 17 May 2006 06:23:09 +0000 |
| Subject: | note 66226 added to function.domxml-open-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-111477@lists.php.net to get a copy of this message | ||
A very useful undocumented feature if you are opening hundreds of xml docs (my script processes
20,000) is DomDocument->free.
This clears the allocated the memory used by the xml file which is not done automatically by just
opening a new file on the same variable.
Example:
<?
$dir="/path/to/xml/files/";
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if(is_file($dir.$file))
{
echo $file . "\\n";
$dom=domxml_open_file($dir.$file);
#...
#You xml processor here
#...
$dom->free();
}
}
closedir($dh);
}
?>
----
Server IP: 85.116.0.130
Probable Submitter: 82.71.52.53
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.domxml-open-file.php
Edit -- http://master.php.net/note/edit/66226
Del: integrated -- http://master.php.net/note/delete/66226/integrated
Del: useless -- http://master.php.net/note/delete/66226/useless
Del: bad code -- http://master.php.net/note/delete/66226/bad+code
Del: spam -- http://master.php.net/note/delete/66226/spam
Del: non-english -- http://master.php.net/note/delete/66226/non-english
Del: in docs -- http://master.php.net/note/delete/66226/in+docs
Del: other reasons-- http://master.php.net/note/delete/66226
Reject -- http://master.php.net/note/reject/66226
Search -- http://master.php.net/manage/user-notes.php