groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BBuzzard <Billy.Buzz...@bnsflogistics.com>
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. V1.properties 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
Reference.

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 <http://groovy.329449.n5.nabble.com/file/n5732187/zzz.groovy>  
T1.xml <http://groovy.329449.n5.nabble.com/file/n5732187/T1.xml>  
V1.properties
<http://groovy.329449.n5.nabble.com/file/n5732187/V1.properties>  
V1.template <http://groovy.329449.n5.nabble.com/file/n5732187/V1.template>  



--
View this message in context: http://groovy.329449.n5.nabble.com/How-do-I-bind-XPath-expression-values-to-a-template-using-Groovy-tp5732187.html
Sent from the Groovy Users mailing list archive at Nabble.com.

Mime
View raw message