The problem i am not able to use both namesapce and return type.
I could use
Is there a way I could do both?
Ah got it
Maybe we should add a 3rd parameter so its easier in the future
I think you can do something like
// here we can pass in the return type as String etc. Namespaces ns = new Namespaces("c", "http://acme.com/cheese"); Expression exp = ns.xpath("expression", String.class); // and then use exp as the expression such as when(exp).to("direct:foo");
Let me know how goes.
I dont think this will solve my problem.
I need to extract a value from XML and add to my header.
Should I be using it as
I know that its gonna be a string at runtime but compiletime?
setHeader("foo", ns.xpath("expression", String.class)).
and that did the trick....
Sorry for misleading you guys,
using the setHeader("").namespace.xpath("",String.class).
is always blank.....
Is there any better way to parse an xml for an element for writing my own processor and DOM parse it in there?
sorry for having marked the question answered earlier
Edited by: sriram on Dec 10, 2009 12:32 AM
This is unusual, I was not even able to get it to compile....
Does this work only with Camel 2.0?
Could be as we have done a lot of work in 2.0 over 1.x.
I was using camel 1.6 and could not compile it....
Is there anyother solution that i could use in 1.6?
Compiles fine in 1.x, just that the mock component is improved in 2.0 so you had to change a bit there for the unit test. But the XPath stuff is 100% identical.