<?php

# based on http://us1.php.net/manual/en/simplexmlelement.xpath.php

$string = <<<XML
<!DOCTYPE test [<!ENTITY booyah "groovy">]>
<foo>&booyah; dude &amp; others</foo>
XML;

$xml = new SimpleXMLElement($string);

/* Search for all nodes */
$result = $xml->xpath('//text()');

while(list( , $node) = each($result)) {
    echo 'Text: ', $node,"\n";
}

?>
