Hi all,
  I am using xpath to set camel header values.  Given a document that looks
something like this:

<?xml version="1.0" encoding="UTF-8"?>
<book xmlns="http://mydomain.com";>
        <chapter>some text</chapter>
</book>


I can do something like this fine:

.setHeader(MY_HEADER_NAME).
.xpath("/nsprefix:book/nsprefix:chapter/text()",String.class, new
Namespaces("nsprefix","http://mydomain.com";))


But this pollutes my xpath expression with all the prefixes.  What I want to
be able to do is something like this:

.setHeader(MY_HEADER_NAME).xpath("book/chapter/text()",String.class, new
Namespaces("","http://mydomain.com";))


But this doesn't work.  I would have hoped that specifying an empty string
for the prefix as I did above would inform camel that elements without a
prefix have an implied namespace of "http://mydomain.com",but this doesn't
work.

Is there a way in camel to specify the implied namespace for elements that
don't have a prefix in my xpath?  If not, is there any technical reason this
couldn't be implemented?

Thanks!

-edward




--
View this message in context: 
http://camel.465427.n5.nabble.com/How-can-I-avoid-setting-namespace-prefixes-in-xpath-expressions-in-camel-tp5742461.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to