You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by davsclaus <ci...@yahoo.dk> on 2011/05/05 08:56:37 UTC
Re: help to extract part of message and insert it to a file
You can use XPath to extract the <age> tag. To insert that into the other
message, you can use plain JAXP.
Using plain java code to do this taks seems like a good choice
public class MyBean {
public void doSomething(@XPath("/Person/age/") Object age) {
// load the file
// insert the age into the file, either using JAXP or for example plain
String.
}
}
And then you route the message to this bean
from X
beanRef(MyBean.class, "doSomething");
You may need to adjust the @XPath annotation to grab the age stuff. If you
XML uses namespace you need to declare that as well. See the Camel XPath
wiki page.
There are many some more nicer and handy frameworks for working with XML
than JAXP (which seems very low level, clumpy and you need to write a fair
amount of code to do simple tasks)
-----
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
--
View this message in context: http://camel.465427.n5.nabble.com/help-to-extract-part-of-message-and-insert-it-to-a-file-tp4371134p4372073.html
Sent from the Camel - Users mailing list archive at Nabble.com.