groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BBuzzard <>
Subject How do I bind XPath expression values to a template using Groovy
Date Mon, 04 Apr 2016 18:26:11 GMT
I have a small Groovy Class called "zzz". The purpose of this class is to
first demonstrate successfully passing a binding to the template engine
producing an output and then failing to bind to another template engine
using what appears to be the same set of bindings.

V1.template contains the base message that will be used with the bindings to
produce a final output. contains an XPath expression that
should grab the value from an XML document and add it to the bindings.
T1.xml is the raw xml input file.

In the zzz Groovy Class I have hard coded the LastName in bindings1 and that
works. But, when I grab the lastName value from the XML file and add it to
bindings2 it fails. Both bindings appear to have exactly the same text, but
I have noticed that bindings1 is of type Bindings and binding2 is of type

I assume that bindings2 being of Reference is what is causing my problem,
but I don't know how to cast or convert it to Binding. Please let me know
what I'm doing wrong.

I'm using Java 1.8 with groovy-all-2.3.10.jar

zzz.groovy <>  
T1.xml <>
V1.template <>  

View this message in context:
Sent from the Groovy Users mailing list archive at

View raw message