You are here

protected function FrxSyntaxEngine::simplexml_evaluate in Forena Reports 6

Same name and namespace in other branches
  1. 6.2 FrxSyntaxEngine.inc \FrxSyntaxEngine::simplexml_evaluate()
  2. 7 FrxSyntaxEngine.inc \FrxSyntaxEngine::simplexml_evaluate()
  3. 7.2 FrxSyntaxEngine.inc \FrxSyntaxEngine::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 FrxSyntaxEngine::simplexml_evaluate()
FrxSyntaxEngine::get_value in ./FrxSyntaxEngine.inc
Get the value from the data. This is used by token_replace method to extract the data based on the path provided.

File

./FrxSyntaxEngine.inc, line 73
FrXSytnaxEngine defines how regular expression procesing/token substitution takes place. It includes support for passing in a formatter oobject that will escape strings properly before substituting them.

Class

FrxSyntaxEngine

Code

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;
}