Hi,
had the same issue with a document having a default namespace defined, sth
like
<doc xmlns="urn:abc"><tag1><tag2>hello</tag2><tag3>world</tag3></tag1></doc>
To get the value 'hello' from the above document, I tried in my bean
public String getGreeting(@Xpath("doc/tag1/tag2/text()") String greeting) {
return greeting;
}
which returned an empty String.
The solution is to 'mimic' if there was a prefix e.g. "p", in this case the
Xpath looks like:
@Xpath(value="p:doc/p:tag1/p:tag2/text()", namespaces=
@NamespacePrefix(prefix="p", uri="urn:abc"))
which returned "hello".
A bit cumbersome, but it worked ;)
Hope this helps,
Kris
--
View this message in context:
http://camel.465427.n5.nabble.com/XPath-namespaces-in-Spring-DSL-tp4556826p5721221.html
Sent from the Camel - Users mailing list archive at Nabble.com.