note 36431 added to function.xml-parse
| From: | Adam at rn2 dot php dot net | Date: | Thu, 09 Oct 2003 09:45:02 +0000 |
| Subject: | note 36431 added to function.xml-parse | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-58096@lists.php.net to get a copy of this message | ||
Hello. It's me again.
Found a notice-bug in my XML-parser. When you have full error-reporting the old version of the code
works but generates a LOT of notice-messages.
Here is the revised version of the code:
function startElement($parser, $tag, $attributeList) {
eval("\$vars = get_object_vars(".$this->path.");");
$this->path .= "->".$tag;
if ($vars and array_key_exists($tag, $vars)) {
eval("\$data = ".$this->path.";");
if (is_array($data)) {
$index = sizeof($data);
$this->path .= "[".$index."]";
} else if (is_object($data)) {
eval($this->path." = array(".$this->path.");");
$this->path .= "[1]";
}
}
eval($this->path." = null;");
foreach($attributeList as $name => $value)
eval($this->path."->".$name. " =
'".XMLParser::cleanString($value)."';");
}
----
Manual Page -- http://www.php.net/manual/en/function.xml-parse.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36431
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36431&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36431&report=yes
Search -- http://master.php.net/manage/user-notes.php