commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From NJuk Njuk <>
Subject Re: [configuration] XPathExpressionEngine Variable Interpolation
Date Tue, 01 Feb 2011 23:58:30 GMT
finally got a chance to look into this.  oliver, the extra information at
the end of your message was the hint that helped.  indeed i was relying on
the original dot-notation within my configuration files so when i switched
to xpath it was unable to interpolate those.

in my case, i have a large number of configuration files, all of which use
the standard dot-notation for interpolating values.  however, i came across
a case where the use of xpath would access select resources in a more
economical manner.  for me to go back and convert all my interpolated values
to use xpath slash-notation would be too difficult --- both code and
configuration would be touched.

it seems that if one is using interpolation then you can either use either
the standard expression engine or the xpath expression engine but not both.

thanks for the clarification.

On Sun, Jan 23, 2011 at 8:15 AM, Oliver Heger

> 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:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message