An easy way to achieve this is using
.setHeader("headername", xpath("//myelement"))
in your route. This way you can extract informations and add these as headers to the camel message.
You can then call a bean and work with these headers.

You can also write your bean like
public class MyBean {
    public String createText(@Xpath("//myelement") myElement) {
        return myElement;
    }
}

The camel bean component allows to write a normal java class to process your xml. Using annotations like above you can extract parts from the message. Returning a String means you overwrite the message body with this string.

You use the following in your route to call your bean:

.bean(new MyBean())

See:
http://camel.apache.org/bean-integration.html
http://camel.apache.org/xpath.html

The order example from the webinar could also be intersting as it extracts data from xml and puts it is a mail body.
https://github.com/cschneider/camel-webinar/tree/master/examples/example-order
The example uses a velocity template to build the mail body which is an alternative to using your own bean.

Christian


Am 10.01.2012 06:35, schrieb shaharyar:
thanks alot chris for your kind help
actually i just want to get values from that XML and nothing else.XML
parsing is not an issue.The real issue was that i want to build a route
which pick XML from a folder and then send it to processor and then
processor after parsing it (mean getting values from the file) write it into
a plain text file and place that file in another folder.
Thanks again.

--
View this message in context: 
http://camel.465427.n5.nabble.com/i-am-newbie-to-camel-tp5127199p5133380.html
Sent from the Camel - Users mailing list archive at Nabble.com.


--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com

Reply via email to