You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Ashwin Karpe <ak...@fusesource.com> on 2010/09/07 17:38:55 UTC

Re: Some camel questions?

Hi,

The Xpath processor in Camel is namespace-aware.

If you use DSL you can do the following

    Namespaces ns = new Namespaces("c", "http://acme.com/cheese");
    from("direct:start").filter().
        xpath("/c:person[@name='James']", ns).
        to("mock:result");

For more details, please check out
http://camel.apache.org/xpath.html http://camel.apache.org/xpath.html 

Cheers,

Ashwin...

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com.com
http://opensourceknowedge.blogspot.com 
---------------------------------------------------------
-- 
View this message in context: http://camel.465427.n5.nabble.com/Some-camel-questions-tp2806185p2806283.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Could I configure to remove InstrumentStrategy of camel?

Posted by ext2 <xu...@tongtech.com>.
Hi:
	Camel's InstrumentationStrategy will works by default. Could I
configured to remove it? 
	Because I wont to implement mine InstrumentationStrategy instead;

Thanks any suggestion;




Re: Some camel questions?

Posted by "Willem.Jiang" <wi...@gmail.com>.
>From the stack trace, I can see it's
javax.xml.xpath.XPathExpressionException.
So I doubt it could be you XPathExpressionException.

Willem

-- 
View this message in context: http://camel.465427.n5.nabble.com/Some-camel-questions-tp2806185p2838558.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Some camel questions?

Posted by mpogra <mp...@gmail.com>.
Any further help will be appritiated. Thanks.
-- 
View this message in context: http://camel.465427.n5.nabble.com/Some-camel-questions-tp2806185p2837581.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Some camel questions?

Posted by mpogra <mp...@gmail.com>.

It is still now working and throwing same exception. I think xpath is still
valid with namespace prefix as my xml have it. 


-- 
View this message in context: http://camel.465427.n5.nabble.com/Some-camel-questions-tp2806185p2834859.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Some camel questions?

Posted by Willem Jiang <wi...@gmail.com>.
I don't think you are using the right XPath and the right parameters for 
the evaluate.
Can you try to use below code ?

String s2 =
  d.xpath("/sea:ESROrder/OrderDetails/ResponseDetails/Status", 
String.class).evaluate(e);

Willem

On 9/9/10 5:33 PM, mpogra wrote:
>
> Sorry..the code that i changed it:
>
> 	String s2 =
> d.xpath("/sea:ESROrder/sea:OrderDetails/sea:ResponseDetails/sea:Status").evaluate(e.getContext(),
> e.getIn().getBody(String.class));
>
> I have added namespace prefix to it.


Re: Some camel questions?

Posted by mpogra <mp...@gmail.com>.
Sorry..the code that i changed it:

	String s2 =
d.xpath("/sea:ESROrder/sea:OrderDetails/sea:ResponseDetails/sea:Status").evaluate(e.getContext(),
e.getIn().getBody(String.class));

I have added namespace prefix to it.
-- 
View this message in context: http://camel.465427.n5.nabble.com/Some-camel-questions-tp2806185p2827179.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Some camel questions?

Posted by mpogra <mp...@gmail.com>.
Hi Willem,

Thanks for reply. The code that I posted earlier does not throw any
exception but does not also return any value for node. When i changed xpath
to:


Then below is the exception stack trace:


> [aultMessageListenerContainer-1] DefaultErrorHandler            ERROR
> Failed delivery for exchangeId: ID:impetus-594-116
> 1-1284023915401-3:1:1:1:1. Exhausted after delivery attempt: 1 caught:
> org.apache.camel.builder.xml.InvalidXPathExpressi
> on: Invalid xpath:
> /sea:Order/sea:OrderDetails/sea:ResponseDetails/sea:Status. Reason:
> javax.xml.xpath.XPathExpressio
> nException
> org.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath:
> /sea:Order/sea:OrderDetails/sea:ResponseDetails/s
> ea:Status. Reason: javax.xml.xpath.XPathExpressionException
>         at
> org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:562)[camel-core-2.4.0-fuse-00-00.jar:2
> .4.0-fuse-00-00]
>         at
> org.apache.camel.builder.xml.XPathBuilder.evaluate(XPathBuilder.java:543)[camel-core-2.4.0-fuse-00-00.jar:2.4
> .0-fuse-00-00]
>         at
> org.apache.camel.builder.xml.XPathBuilder.evaluate(XPathBuilder.java:127)[camel-core-2.4.0-fuse-00-00.jar:2.4
> .0-fuse-00-00]
>         at
> org.apache.camel.builder.xml.XPathBuilder.evaluate(XPathBuilder.java:189)[camel-core-2.4.0-fuse-00-00.jar:2.4
> .0-fuse-00-00]
>         at
> biz.neustar.adapters.wireline.RequestRouteBuilder$1.process(RequestRouteBuilder.java:82)[file:/D:/camelWork/P
> rojectRoot/simple-adapter/wireline/target/classes/:]
>         at
> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProc
> essorTypeConverter.java:50)[camel-core-2.4.0-fuse-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.4.0-fuse-00-00.
> jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.4.
> 0-fuse-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.4.0-fu
> se-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[camel-core-2.4
> .0-fuse-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.4.0-fuse-00-00.
> jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.4.
> 0-fuse-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.4.0-fu
> se-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)[camel-core-2.4.0-fu
> se-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.4.0-fuse-00-00.
> jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.4.
> 0-fuse-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.4.0-fu
> se-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[camel-core-2.4
> .0-fuse-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.4.0-fuse-00-00.
> jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:290)[camel-
> core-2.4.0-fuse-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:202)[camel-core-2.4.0-f
> use-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:256)[camel-core-2.4.0-fuse-00-00.jar:2.
> 4.0-fuse-00-00]
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.4.0-fuse-00-00.
> jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:143)[camel-core-2.4.0-fuse-00-00.jar:2.4.0-fuse-00-
> 00]
>         at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:78)[camel-core-2.4.0-fuse-00-00.jar:2.4.0-fuse-00-0
> 0]
>         at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:99)[camel-core-2.4.0-fuse-00-
> 00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.4.0-fuse-00-00.
> jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.4.
> 0-fuse-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.4.0-fu
> se-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[camel-core-2.4
> .0-fuse-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:91)[camel-core-2.4.0-fuse-00-00.
> jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)[camel-core-2.4.0-fu
> se-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:85)[camel-jms-2
> .4.0-fuse-00-00.jar:2.4.0-fuse-00-00]
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerCon
> tainer.java:560)[spring-jms-3.0.3.RELEASE.jar:3.0.3.RELEASE]
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerConta
> iner.java:498)[spring-jms-3.0.3.RELEASE.jar:3.0.3.RELEASE]
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerCo
> ntainer.java:467)[spring-jms-3.0.3.RELEASE.jar:3.0.3.RELEASE]
>         at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingM
> essageListenerContainer.java:323)[spring-jms-3.0.3.RELEASE.jar:3.0.3.RELEASE]
>         at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMes
> sageListenerContainer.java:261)[spring-jms-3.0.3.RELEASE.jar:3.0.3.RELEASE]
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(D
> efaultMessageListenerContainer.java:1056)[spring-jms-3.0.3.RELEASE.jar:3.0.3.RELEASE]
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLo
> op(DefaultMessageListenerContainer.java:1048)[spring-jms-3.0.3.RELEASE.jar:3.0.3.RELEASE]
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessa
> geListenerContainer.java:947)[spring-jms-3.0.3.RELEASE.jar:3.0.3.RELEASE]
>         at java.lang.Thread.run(Thread.java:619)[:1.6.0_03]
>  

Please suggest.

Also if you have any answer to other question; it will be helpful.

Thanks,
Mahesh.
-- 
View this message in context: http://camel.465427.n5.nabble.com/Some-camel-questions-tp2806185p2827177.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Some camel questions?

Posted by "Willem.Jiang" <wi...@gmail.com>.
which part is not working, and can you show us the stack trace?

btw, you mail is appear in the user@camel.apache.org. Please subscribe the
mail list first. 
-- 
View this message in context: http://camel.465427.n5.nabble.com/Some-camel-questions-tp2806185p2827116.html
Sent from the Camel - Users mailing list archive at Nabble.com.