note 60057 added to function.domnode-get-content

From: Date: Sat, 24 Dec 2005 07:43:52 +0000
Subject: note 60057 added to function.domnode-get-content
Groups: php.notes 
Request: Send a blank email to php-notes+get-100653@lists.php.net to get a copy of this message
Only to correct a very small error, but maybe difficult to find in che function GetContentAsString posted by someone in April 2005. There was $anode-node_value() instead of $anode->node_value(). This is the right version: <?php function GetContentAsString($node) { $st = ""; foreach ($node->child_nodes() as $cnode) if ($cnode->node_type()==XML_TEXT_NODE) $st .= $cnode->node_value(); else if ($cnode->node_type()==XML_ELEMENT_NODE) { $st .= "<" . $cnode->node_name(); if ($attribnodes=$cnode->attributes()) { $st .= " "; foreach ($attribnodes as $anode) $st .= $anode->node_name() . "='" . $anode->node_value() . "'"; } $nodeText = GetContentAsString($cnode); if (empty($nodeText) && !$attribnodes) $st .= " />"; // unary else $st .= ">" . $nodeText . "</" . $cnode->node_name() . ">"; } return $st; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.domnode-get-content.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60057 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60057&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60057&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60057&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60057&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60057&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60057&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60057&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60057&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#100653) next »