I tried this xpath example in my route and got the below exception:
My Route definition:
from("file://C:/folders/inbox?noop=true").split(xpath("/*/child::pss:persons/text()")).to("file://C:/folders/outbox");
Caused by:
com.sun.org.apache.xpath.internal.domapi.XPathStylesheetDOM3Exception:
Prefix must resolve to a namespace: pss
at
com.sun.org.apache.xpath.internal.compiler.XPathParser.errorForDOM3(Unknown
Source)
at com.sun.org.apache.xpath.internal.compiler.Lexer.mapNSTokens(Unknown
Source)
at com.sun.org.apache.xpath.internal.compiler.Lexer.tokenize(Unknown
Source)
at com.sun.org.apache.xpath.internal.compiler.Lexer.tokenize(Unknown
Source)
at
com.sun.org.apache.xpath.internal.compiler.XPathParser.initXPath(Unknown
Source)
at com.sun.org.apache.xpath.internal.XPath.<init>(Unknown Source)
at com.sun.org.apache.xpath.internal.XPath.<init>(Unknown Source)
... 46 more
I can understand that I have to define the namespace but where do I do that?
Regards,
Jothi
On Fri, Aug 24, 2012 at 9:22 AM, Joe San <[email protected]> wrote:
> Ok. After a bit of reading about xPath, I have the following. But not sure
> if this would work as expected.
>
> The xml:
>
> ....
> ....
> <pss:persons xmlns:pss="persons:datatype">
> <rss:person xmlns:rss="person:datatype">
> <name>jothi</name>
> <age>32</age>
> <gender>M</gender>
> </rss:person>
> </ns:persons>
> ....
> ....
>
> The xPath:
>
> /*/child:psst:persons/text()
>
> Would fetch me all the tags under pss:persons. Did I get this right?
>
> Regards,
> Jothi
>