note 105273 added to function.domnode-get-content
| From: | krnl at osu1 dot php dot net | Date: | Sat, 06 Aug 2011 12:50:04 +0000 |
| Subject: | note 105273 added to function.domnode-get-content | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182279@lists.php.net to get a copy of this message | ||
More common in PHP5
<?php
function getContentAsString($node)
{
$string = '';
foreach($node->childNodes as $child)
switch($child->nodeType)
{
case XML_ELEMENT_NODE:
$string .= '<'.$child->nodeName;
foreach($child->attributes as $attribute)
$string .= '
'.$attribute->name.'="'.$attribute->value.'"';
$nodeText = getContentAsString($child);
if(empty($nodeText))
$string .= '/>';
else
$string .= '>'.$nodeText.'</'.$child->nodeName.'>';
break;
case XML_TEXT_NODE:
$string .= $child->nodeValue;
break;
}
return $string;
}
?>
Greets from
http://krnl.de/
----
Server IP: 69.147.83.197
Probable Submitter: 77.176.159.118
----
Manual Page -- http://www.php.net/manual/en/function.domnode-get-content.php
Edit -- https://master.php.net/note/edit/105273
Del: integrated -- https://master.php.net/note/delete/105273/integrated
Del: useless -- https://master.php.net/note/delete/105273/useless
Del: bad code -- https://master.php.net/note/delete/105273/bad+code
Del: spam -- https://master.php.net/note/delete/105273/spam
Del: non-english -- https://master.php.net/note/delete/105273/non-english
Del: in docs -- https://master.php.net/note/delete/105273/in+docs
Del: other reasons-- https://master.php.net/note/delete/105273
Reject -- https://master.php.net/note/reject/105273
Search -- https://master.php.net/manage/user-notes.php