- var_dump: documentation ( source)
<?php
$str = '<?xml version="1.0" encoding="UTF-8"?>
<foo>
<bar>
<name>Frank</name>
</bar>
</foo>';
$xml = new SimpleXMLElement($str);
$results = $xml->xpath("//foo/bar/name");
$first_result = $results[0];
var_dump( (string)$first_result );
var_dump( $first_result->asXML() );