I guess I got the wrong expression for xpath: org.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath: /*/child::pss:person/text(). Reason: javax.xml.xpath.XPathExpressionException at org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:686) at org.apache.camel.builder.xml.XPathBuilder.evaluate(XPathBuilder.java:667) at org.apache.camel.builder.xml.XPathBuilder.evaluate(XPathBuilder.java:147) at org.apache.camel.processor.Splitter.createProcessorExchangePairs(Splitter.java:101) at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:209) at org.apache.camel.processor.Splitter.process(Splitter.java:96) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:330) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220) at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303) at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150) at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117) at org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73) at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:336) at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:189) at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:155) at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:139) at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:91)
On Fri, Aug 24, 2012 at 11:08 AM, Joe San <codeintheo...@gmail.com> wrote: > 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 <codeintheo...@gmail.com> 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 >> > >