DomQuery::dump();
Takes the current result set of the latest XPath expression and returns an entirely new XML document containing said results. Depending one which constant you use, this method can return the results as an XML string, DOMDocument instance or an array containing instances of PHP's SimpleXmlElement class.
$DomQuery = new DomQuery;
$DomQuery->load($xml);
$xml_string = $DomQuery->dump(DUMP_MODE_STRING);
$DOMDocument = $DomQuery->dump(DUMP_MODE_DOM);
foreach($DomQuery->dump(DUMP_MODE_SIMPLE) as $Xml)
{
echo $Xml->root->foo;
}
Definition:
public function dump($mode = DUMP_MODE_STRING, $xpath_results_only = false)
Parameters:
| Name | Type | Description |
|---|---|---|
| $mode | Integer | Determines the mode in which to save the output (DUMP_MODE_DOM | DUMP_MODE_SIMPLE | DUMP_MODE_STRING). |
| $xpath_results_only | Boolean | Returns only matched elements from latest XPath expression if TRUE. |