Commit 2c13d20b authored by metzlerd's avatar metzlerd
Browse files

Fixed bug in getValue broken = xpath evaluations.

parent f8b0ad9d
......@@ -56,6 +56,27 @@ class FrxData extends FrxContext {
}
/**
* 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.
*
* @param $xml
* @param $path
* @return unknown_type
*/
protected function simplexml_evaluate($xml, $path) {
$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;
}
/**
* Get the value from the data.
* This is used by token_replace method to extract the data based on the path provided.
......
......@@ -35,26 +35,7 @@ class FrxSyntaxEngine {
}
/**
* 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.
*
* @param $xml
* @param $path
* @return unknown_type
*/
protected function simplexml_evaluate($xml, $path) {
$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;
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment