You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Dragisa Krsmanovic <dk...@plos.org> on 2009/08/05 00:59:58 UTC
Error when using XPath functions
Camel 2.0-M3, trying setHeader like:
<setHeader headerName="CamelFileName">
<xpath>substring(//atom:entry/atom:id/text(), 9)</xpath>
</setHeader>
//atom:entry/atom:id/text() returns correct result, but if I try to use any
of the XPath functions I get this error:
org.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath:
substring(//atom:entry/atom:id/text(), 9). Reason:
javax.xml.xpath.XPathExpressionException
Does Camel support XPath functions ?
Thanks,
Dragisa
--
View this message in context: http://www.nabble.com/Error-when-using-XPath-functions-tp24817775p24817775.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Error when using XPath functions
Posted by Dragisa Krsmanovic <dk...@plos.org>.
Claus Ibsen-2 wrote:
>
> On Wed, Aug 5, 2009 at 12:59 AM, Dragisa Krsmanovic<dk...@plos.org>
> wrote:
>>
>> Camel 2.0-M3, trying setHeader like:
>>
>> <setHeader headerName="CamelFileName">
>> <xpath>substring(//atom:entry/atom:id/text(), 9)</xpath>
>> </setHeader>
>>
>> //atom:entry/atom:id/text() returns correct result, but if I try to use
>> any
>> of the XPath functions I get this error:
>>
>> org.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath:
>> substring(//atom:entry/atom:id/text(), 9). Reason:
>> javax.xml.xpath.XPathExpressionException
>>
>> Does Camel support XPath functions ?
>>
>
> Can you get a sample working with the XPath stuff in Java itself?
> That will help us look into this.
>
>
>> Thanks,
>> Dragisa
>> --
>> View this message in context:
>> http://www.nabble.com/Error-when-using-XPath-functions-tp24817775p24817775.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
>
Same error with Java. It's a simple example that reads Atom feed. No Java
code besides RouteBuilder:
errorHandler(deadLetterChannel("mock:error"));
Namespaces ns = new Namespaces("atom", "http://www.w3.org/2005/Atom");
from("rss:http://www.plosone.org/article/feed")
.marshal().rss()
.setHeader(Exchange.HTTP_URI).xpath("//atom:entry/atom:link[@type=\"application/pdf\"]/@href",
ns)
.setHeader(Exchange.FILE_NAME).xpath("substring(//atom:entry/atom:id/text(),
17)", ns) // Does not work
//
.setHeader(Exchange.FILE_NAME).xpath("//atom:entry/atom:id/text()", ns) //
Works
.to("http://foo")
.to("file://outdir");
--
View this message in context: http://www.nabble.com/Error-when-using-XPath-functions-tp24817775p24832496.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Error when using XPath functions
Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Aug 5, 2009 at 12:59 AM, Dragisa Krsmanovic<dk...@plos.org> wrote:
>
> Camel 2.0-M3, trying setHeader like:
>
> <setHeader headerName="CamelFileName">
> <xpath>substring(//atom:entry/atom:id/text(), 9)</xpath>
> </setHeader>
>
> //atom:entry/atom:id/text() returns correct result, but if I try to use any
> of the XPath functions I get this error:
>
> org.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath:
> substring(//atom:entry/atom:id/text(), 9). Reason:
> javax.xml.xpath.XPathExpressionException
>
> Does Camel support XPath functions ?
>
Can you get a sample working with the XPath stuff in Java itself?
That will help us look into this.
> Thanks,
> Dragisa
> --
> View this message in context: http://www.nabble.com/Error-when-using-XPath-functions-tp24817775p24817775.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus