Commit 5c9a58ffcdae40e48d3626a00952b72ed3a25cb4

Authored by Elena Budnik
2 parents 946ea36f 9f267e35

Merge branch 'alias' into 'master'

Alias

See merge request !4
src/InputOutput/IHMImpl/Tools/IHMExpressionParserClass.php
... ... @@ -145,8 +145,8 @@ class IHMExpressionParserClass
145 145 //echo "Source expression : ".$expression.PHP_EOL;
146 146 //clean expression and replace constants and aliases by associated value
147 147 $this->clean($expression);
148   - $this->replaceConstants($expression);
149   - $this->replaceAliases($expression);
  148 + $this->replaceConstants($expression);
  149 + $this->replaceAliases($expression);
150 150 $this->clean($expression);
151 151  
152 152 //explode expression
... ... @@ -276,13 +276,12 @@ class IHMExpressionParserClass
276 276 $this->aliasesArray = array();
277 277  
278 278 $aliases_ = $dom->getElementsByTagName(self::$aliasNode);
279   - for ($i = 1; $i < $aliases_->length; $i++)
280   - $this->aliasesArray[self::$alias_tag.$aliases_->item($i)->getAttribute(self::$aliasNameAtt)] = $aliases_->item($i)->nodeValue;
  279 + for ($i = 0; $i < $aliases_->length; $i++)
  280 + $this->aliasesArray[self::$aliasTag.$aliases_->item($i)->getAttribute(self::$aliasNameAtt)] = $aliases_->item($i)->getAttribute('xml:id');
281 281 }
282 282  
283 283 //replace
284 284 $expression = strtr($expression, $this->aliasesArray);
285   -
286 285 //be sure that all aliases are replaced
287 286 if ($this->isAliasDetected($expression))
288 287 throw new Exception('Cannot replace some aliases : '.$expression);
... ...