camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raul Kripalani <r...@evosent.com>
Subject Re: Camel XQuery - Saxon
Date Tue, 05 Mar 2013 21:50:12 GMT
Try this:

XQueryBuilder.xquery("myScriptWhichUsesTheMathPrefix").namespace("math",
"java:java.lang.Math").


For example, within a filter() DSL:

.filter(XQueryBuilder.xquery("myScriptWhichUsesTheMathPrefix").namespace("math",
"java:java.lang.Math"))
   ....


You can also use this import to avoid having to specify the class name:

import static org.apache.camel.component.xquery.XQueryBuilder.xquery;


then it becomes:

.filter(xquery("myScriptWhichUsesTheMathPrefix").namespace("math",
"java:java.lang.Math"))

   ....

Does that help?

*Raúl Kripalani*
Apache Camel Committer
Enterprise Architect, Program Manager, Open Source Integration specialist
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk <http://twitter.com/raulvk>

On Tue, Mar 5, 2013 at 8:59 AM, Phobos <sm0k3yuk@gmail.com> wrote:

>
> Hi,
>
> Stack trace is as follows, i'm putting together a test case now;
>
> org.apache.camel.RuntimeExpressionException:
> net.sf.saxon.trans.XPathException: Prefix math has not been declared
>         at
>
> org.apache.camel.component.xquery.XQueryBuilder.evaluate(XQueryBuilder.java:144)
>         at
>
> org.apache.camel.component.xquery.XQueryBuilder.process(XQueryBuilder.java:101)
>         at
>
> org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101)
>         at
>
> org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)
>         at
>
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
>         at
>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at
>
> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:122)
>         at
>
> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:298)
>         at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:117)
>         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:72)
>         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:334)
>         at
>
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)
>         at
>
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)
>         at
>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
>
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:308)
>         at
>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:117)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
>         at
>
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)
>         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:72)
>         at
>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
>         at
>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)
>         at
> org.apache.camel.component.http.CamelServlet.service(CamelServlet.java:98)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
>         at
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
>         at
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>         at
>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
>         at
>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
>         at
>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>         at
>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
>         at
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
>         at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
>         at
>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
>         at
>
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
>         at
>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
>         at
>
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
>         at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>         at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>         at java.lang.Thread.run(Thread.java:680)
> Caused by: net.sf.saxon.trans.XPathException: Prefix math has not been
> declared
>         at net.sf.saxon.query.QueryParser.grumble(QueryParser.java:393)
>         at
> net.sf.saxon.expr.ExpressionParser.grumble(ExpressionParser.java:211)
>         at
>
> net.sf.saxon.expr.ExpressionParser.resolveFunctionName(ExpressionParser.java:2234)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseFunctionCall(ExpressionParser.java:2068)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseBasicStep(ExpressionParser.java:1525)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseStepExpression(ExpressionParser.java:1454)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseRelativePath(ExpressionParser.java:1389)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parsePathExpression(ExpressionParser.java:1375)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseUnaryExpression(ExpressionParser.java:1230)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseCastExpression(ExpressionParser.java:849)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseCastableExpression(ExpressionParser.java:804)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseTreatExpression(ExpressionParser.java:785)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseInstanceOfExpression(ExpressionParser.java:767)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseIntersectExpression(ExpressionParser.java:1263)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseUnionExpression(ExpressionParser.java:1245)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseMultiplicativeExpression(ExpressionParser.java:1181)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseAdditiveExpression(ExpressionParser.java:1161)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseRangeExpression(ExpressionParser.java:1046)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseComparisonExpression(ExpressionParser.java:995)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseAndExpression(ExpressionParser.java:568)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseOrExpression(ExpressionParser.java:550)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseExprSingle(ExpressionParser.java:474)
>         at
> net.sf.saxon.query.QueryParser.parseLetClause(QueryParser.java:2219)
>         at
> net.sf.saxon.query.QueryParser.parseForExpression(QueryParser.java:1906)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseExprSingle(ExpressionParser.java:450)
>         at
>
> net.sf.saxon.expr.ExpressionParser.parseExpression(ExpressionParser.java:418)
>         at net.sf.saxon.query.QueryParser.parseQuery(QueryParser.java:313)
>         at
> net.sf.saxon.query.QueryParser.makeXQueryExpression(QueryParser.java:135)
>         at
>
> net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:489)
>         at
>
> net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:551)
>         at
>
> org.apache.camel.component.xquery.XQueryBuilder$3.createQueryExpression(XQueryBuilder.java:259)
>         at
>
> org.apache.camel.component.xquery.XQueryBuilder.initialize(XQueryBuilder.java:633)
>         at
>
> org.apache.camel.component.xquery.XQueryBuilder.evaluateAsDOM(XQueryBuilder.java:173)
>         at
>
> org.apache.camel.component.xquery.XQueryBuilder.evaluate(XQueryBuilder.java:134)
>         ... 55 more
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-XQuery-Saxon-tp5728490p5728551.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message