You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by zasy <ju...@gmail.com> on 2015/04/09 14:33:58 UTC

How to add new element in xml using Spring Camel Context

Hi,

I am developing with JBoss fuse, camel context. I have a requirement where I
need to add a new element in the input xml, the value will be from input
header. I want to avoid java stuffs, so is it possible to do that in camel
context xml itself using xpath or setBody something like that?

I would be really grateful if someone can answer to this or share some
example, references.



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-add-new-element-in-xml-using-Spring-Camel-Context-tp5765511.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to add new element in xml using Spring Camel Context

Posted by zasy <ju...@gmail.com>.
Hi Claus,

Thank you so much. XSLT solved my purpose. You are a Saviour:-)



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-add-new-element-in-xml-using-Spring-Camel-Context-tp5765511p5765587.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to add new element in xml using Spring Camel Context

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

No you can use xslt in spring xml. Its standard XML Transformation.
Although if you have no experience with xslt before then it can be
"hard" to learn as its not like regular programming.

http://camel.apache.org/xslt

For xslt you may search the internet or stackoverflow
http://stackoverflow.com/questions/54683/how-do-you-insert-xml-into-an-existing-xml-node


On Thu, Apr 9, 2015 at 4:28 PM, zasy <ju...@gmail.com> wrote:
> Hi Claus,
>
> Thanks for your reply. So for this we need to create java bean? we can not
> simply set in the spring xml?
> Also if you can share some reference link that will be really helpful.
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-add-new-element-in-xml-using-Spring-Camel-Context-tp5765511p5765526.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: How to add new element in xml using Spring Camel Context

Posted by zasy <ju...@gmail.com>.
Hi Claus,

Thanks for your reply. So for this we need to create java bean? we can not
simply set in the spring xml?
Also if you can share some reference link that will be really helpful.




--
View this message in context: http://camel.465427.n5.nabble.com/How-to-add-new-element-in-xml-using-Spring-Camel-Context-tp5765511p5765526.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to add new element in xml using Spring Camel Context

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You may be able to use xslt transformations when you work with XML.
An alternative is a template based.

Or sometimes a search/replace can do it, if you know that the xml has
a fixed value you can use for search and then replace it with the
extra values you need.

But XML has XSLT as the answer for xml manipulations.

There is also scripting languages like groovy or the likes you may be
able to write a little bit of "code" in the xml that can do it.



On Thu, Apr 9, 2015 at 2:33 PM, zasy <ju...@gmail.com> wrote:
> Hi,
>
> I am developing with JBoss fuse, camel context. I have a requirement where I
> need to add a new element in the input xml, the value will be from input
> header. I want to avoid java stuffs, so is it possible to do that in camel
> context xml itself using xpath or setBody something like that?
>
> I would be really grateful if someone can answer to this or share some
> example, references.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-add-new-element-in-xml-using-Spring-Camel-Context-tp5765511.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/