Dale,

Thanks for the help - I thought there was an optional 2nd arg for type,
but my Eclipse code completion didn't list it.  I put it in anyway
and got:

The method xpath(String) in the type BuilderSupport is not applicable for the arguments (String, Class<String>)

...then I tried the single arg version of setHeader, chained to the xpath:

.setHeader("FOOBAR").xpath("string(/task/clientId/@value)", String.class)

This worked. I guess that's what you meant, but it solved my issue - thanks for the help.

Chris

On 10/8/2013 4:28 PM, Dale King wrote:
Try

.setHeader("FOO", xpath("/foo/bar/@value", String.class))

xpath assumes that it will return a node list. You have to tell it if that is 
not the case. I have a similar issue with an xpath with a count expression and 
it throws an exception because it cannot convert from number to node list.

On Oct 8, 2013, at 4:23 PM, Chris <[email protected]> wrote:


If my in msg body is:

<foo>
  <bar value="hello"/>
</foo>

...then, when doing:

.setHeader("FOO", xpath("/foo/bar/@value"))

I expect the header named "FOO" to have String value of "hello", instead, I 
see: net.sf.saxon.dom.DOMNodeList@74184b3b

Is there any way to make this work?

Thanks,

Chris


Reply via email to