commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@oliver-heger.de>
Subject Re: [configuration] XPathExpressionEngine Variable Interpolation
Date Sun, 23 Jan 2011 16:15:15 GMT
Am 23.01.2011 00:57, schrieb NJuk Njuk:
> i've been using Commons Configuration on a particular project for several
> years.  until lately i have been using the DefaultExpressionEngine --- or at
> least i believe i have since i've never called setExpressionEngine().  my
> configuration is specified by a set of xml files, some of which use variable
> interpolation (via ${} syntax) to define property values.
>
> i recently had a case where the use of XPATH would be helpful in obtaining
> certain configuration values.  when i switched the expression engine to
> XPathExpressionEngine, i was able to locate the necessary configuration
> properties but their values resulted in the non-interpolated string.  if i
> use the DefaultExpressionEngine, the values are properly interpolated.
>
> am i wrong in assuming that XPathExpressionEngine should transparently
> variable interpolation like DefaultExpressionEngine does?  i saw no mention
> of this, one way or the other, in the Commons Configuration documentation.
>
> thanks in advance for any guidance.
>

You are right, interpolation should work the same way for the 
XPathExpressionEngine as for the default one.

Would it be possible to post a code fragment and an example 
configuration file so that we can reproduce the problem?

What might be the cause for your problem is the fact that when using 
XPathExpressionEngine this engine is also used for interpreting the 
interpolated variables, i.e. the expressions in ${} syntax. If these 
expressions are not valid XPath expressions, the corresponding values 
cannot be retrieved; in this case the non-interpolated strings are returned.

Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message