note 42179 deleted from ref.xml by bjori

From: Date: Mon, 09 Oct 2006 11:17:07 +0000
Subject: note 42179 deleted from ref.xml by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-118303@lists.php.net to get a copy of this message
Note Submitter: moc.oohay@mijito ---- I found a type-o in the XMLTag->addChild function. I re-examined the code and changed the function so it is a little cleaner. Also, as an interesting side-note. I ran the script on a 1 MB XML file. The php.exe memory usage exceeded 50 MB during runtime. I did a print_r($XML_data) dumping into a plain-text file which resulted in a 70 MB text file. However, after I removed all the [spaces] used for formatting and readability the file size was reduced to 5 MB. This script may not be efficient for very large data sets. ;) I am very pleased that the script parsed the file without error. A very successful "real world" test. Repaired addChild: function addChild($XMLTag_obj) { $key = $XMLTag_obj->name; // If this tag *name* is not already a child initialize it. if ( !isset($this->children[$key][0]) ) { $this->children[$key][0] = 0; } // Get the next array index. This is the next available location to store the child $index = $this->children[$key][0] + 1; // Add the child and update the tag count $this->children[$key][$index] = $XMLTag_obj; $this->children[$key][0]++; // Return the Child Tag return $this->children[$key][$index]; }

« previous php.notes (#118303) next »