I'm trying to use camel xpath filter in my camel route. I get an error in my unit test that I cannot solve. I Would appreciate some help.
When trying to analyse the following xml:
<publication>
<publicationId>1</publicationId>
<alias>false</alias>
<publicationType>NEW</publicationType>
<zone>VALIDATION</zone>
<routingKey>WWX_VECTOR</routingKey>
<contexts>
<context>GEO</context>
</contexts>
<resource>
<resourceFamily>
<releasedOnPww>false</releasedOnPww>
</resourceFamily>
<featureType>
<name>buildings</name>
</featureType>
</resource>
</publication>
With the following xpath:
.filter().xpath("/publication/resource/resourceFamily/releasedOnPww/text() = 'true'")
I get the following exception:
Caused by: java.lang.RuntimeException: Unable to evaluate expression using this context
at com.sun.org.apache.xpath.internal.axes.NodeSequence.setRoot(NodeSequence.java:212)
at com.sun.org.apache.xpath.internal.axes.LocPathIterator.execute(LocPathIterator.java:210)
at com.sun.org.apache.xpath.internal.Expression.execute(Expression.java:153)
at com.sun.org.apache.xpath.internal.operations.Operation.execute(Operation.java:107)
at com.sun.org.apache.xpath.internal.XPath.execute(XPath.java:335)
What's kind of weird is that the code seems to run OK in run-time, the error occurs only during unit testing.