Re: i am newbie to camel
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
Re: i am newbie to camel
thanks chris .. please send me some links for tutorials. Actually i want to read an XML from a source and want to parse from processor and after parsing i want to place it in another place(parsed XML) -- View this message in context: http://camel.465427.n5.nabble.com/i-am-newbie-to-camel-tp5127199p5130532.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: i am newbie to camel
My colleague Hadrian did a webinar about camel some time ago. The example reads an xml file, parses it, does a choice using xpath and then writes a file again. Should be quite what you try to achieve: http://www.talend.com/webinar/archive/index.php Look for Application Integration / Apache Camel Fundamentals Part 1 The complete source of the example is available from my github account: https://github.com/cschneider/camel-webinar/tree/master/part1/camel-example2-java You can just copy that and use it as a starting point. What the example does not show so much is how parsing the xml works as this is quite hidden in camel. If you can tell me what you want to do with the parsed xml I can perhaps give you some more hints how to achieve it. Christian Am 09.01.2012 07:00, schrieb shaharyar: thanks chris .. please send me some links for tutorials. Actually i want to read an XML from a source and want to parse from processor and after parsing i want to place it in another place(parsed XML) -- View this message in context: http://camel.465427.n5.nabble.com/i-am-newbie-to-camel-tp5127199p5130532.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
Re: i am newbie to camel
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.
Re: i am newbie to camel
Hi, you need to provide a little more context. What are you trying to do and what goes wrong? If you simply search a way to start you should look at the examples in the distribution and the tutorials. Christian Am 07.01.2012 06:20, schrieb shaharyar: hi folks I am very new with camel. i want to parse an XML but got a lot of confusion in URI and some other stuff.Any sample code would be more helpful for parsing the XML. Thanks -- View this message in context: http://camel.465427.n5.nabble.com/i-am-newbie-to-camel-tp5127199p5127199.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