protected function FrxData::simplexml_evaluate in Forena Reports 7.4
Same name and namespace in other branches
- 7.3 FrxData.inc \FrxData::simplexml_evaluate()
Provides an api to the {=xpath} syntax that can be used to evaluat expressions such as sum and count in a report. We need to use the DOM object here, because this method isn't exposed with simplexml.
Parameters
$xml:
$path:
Return value
unknown_type
1 call to FrxData::simplexml_evaluate()
- FrxData::getValue in ./
FrxData.inc - Get the value from the data. This is used by token_replace method to extract the data based on the path provided.
File
- ./
FrxData.inc, line 98
Class
Code
protected function simplexml_evaluate($xml, $path) {
if (!method_exists($xml, 'xpath')) {
return '';
}
$dom_node = dom_import_simplexml($xml);
$dom_doc = new DOMDocument('');
$dom_node = $dom_doc
->importNode($dom_node, TRUE);
$dom_doc
->appendChild($dom_node);
// Do we also need to call AppendChild?
$xpath = new DOMXpath($dom_doc);
$ret = $xpath
->evaluate($path, $dom_node);
return $ret;
}