Hi all,
I'm using commons-configuration with the XPathExpressionEngine installed
on a CompositeConfiguration based on an XMLConfiguration and a
PropertiesConfiguration.
I'd like to use some user defined xpath function, via implementation of
org.apache.commons.jxpath.Functions and
org.apache.commons.jxpath.Function, but doing this I need to wrap most
of the feature the Configuration implementation give to me.
I try to explain with an example.
This is the xml part of the configuration file
**********
config.xml
**********
<conf>
<big-integer>
<direct-link value="99887766"/>
<indirect-link
value="resolver-ns:resolve-value(/conf/[EMAIL PROTECTED]'big-integer-link']/va
lue/@val)"/>
<interpolated-indirect-link
value="resolver-ns:resolve-value(/conf/[EMAIL PROTECTED]'big-integer-link']/in
terpolated/@value)"/>
<double-indirect-link
value="resolver-ns:resolve-value(/conf/[EMAIL PROTECTED]'big-integer-link']/in
direct-link/@value)"/>
<interpolate-link value="${big-integer.value}"/>
</big-integer>
<link name="big-integer-link">
<interpolated value="${big-integer.value}"/>
<value val="1122334455"/>
<indirect-link
value="resolver-ns:resolve-value(/conf/[EMAIL PROTECTED]'big-integer-do
uble-link']/value/@val)"/>
</link>
</conf>
And this is the part for the properties file
*****************
config.properties
*****************
big-integer.value=9021784365
both of them are loaded within a CompositeConfiguration configured as
*****************
composite.xml
*****************
<configuration>
<properties fileName="config.properties"/>
<xml fileName="config.xml"/>
</configuration>
As you can see in the xml file there's a user defined xpath function
resolve-value, which is able to resolve an xpath expression and return
the value addressed.
To do this I need to extrapolate a JXPathContext from the Document of
the XMLConfiguration, but this mean to browse it without some feature
such as variable interpolation.
As a consequence I need to reimplement those sort of feature.
So the question is, is it possible to install user defined functions in
addition to an XPathExpressionEngine?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]