note 59178 deleted from function.dom-domdocument-loadhtmlfile by didou
| From: | didou@php.net | Date: | Sat, 30 Dec 2006 03:21:29 +0000 |
| Subject: | note 59178 deleted from function.dom-domdocument-loadhtmlfile by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121054@lists.php.net to get a copy of this message | ||
Note Submitter: yellow5 at beggarchooser dot com
----
Here's the function I use to recursively get all text within a node:
function GetNodeText($ndNode)
{
$sTagText = "";
if ($ndNode->nodeName == "#text")
{
$sTagText = $ndNode->nodeValue;
}
if ($ndNode->hasChildNodes())
{
$sTagText .= GetNodeText($ndNode->firstChild);
}
if ($ndNode->nextSibling)
{
$sTagText .= GetNodeText($ndNode->nextSibling);
}
return $sTagText;
}