Here\'s my XML data:
$data = \'Report of the Fifth International Foo and Bar Confe
This can be easily done in DOM. DOM element nodes have a property $textContent, that will return its text content including all descendant text nodes.
$document = new DOMDocument();
$document->loadXml($data);
var_dump($document->documentElement->textContent);
Output:
string(99) "Report of the Fifth International Foo and Bar Conference, Foobar Hall, London, July 14 to 16, 1908."
If you do not have the element node already in a variable, it will be more convenient to use XPath.
$document = new DOMDocument();
$document->loadXml($data);
$xpath = new DOMXpath($document);
var_dump($xpath->evaluate('string(/title)'));
It is even possible to convert a SimpleXMLElement into a DOM element node.
$element = new SimpleXMLElement($data);
$node = dom_import_simplexml($element);
var_dump($node->textContent);