Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new

Learn more

View all

Sign in to view all badges

Adding node(s) to XML process variable

Not applicable

I have a process with an XML variable, i.e.

var myXML = <package>


                            <foo name="A">....</foo>

                            <foo name="B">....</foo>

                            <foo name="C">....</foo>



and I need to add an additional subtree <foo name="D">...</foo> to this variable under /package/assets/.

I am trying to use SetValue but cannot get it to work.

What's the best way to do this?

1 Reply
Level 3
Level 3


I did this befor but I do not know if it is th e"best way", what I did is simply cut and paste, substirng and concatenate.

let me show you an example:

in a SetValue use the following variables and their values (expressions)

/process_data/xmlVar1         deserialize('<package> <assets> <foo name="A">....</foo> <foo name="B">....</foo>

                                        <foo name="C">....</foo> </assets> </package>')

/process_data/@strXmlVar      serialize(/process_data/xmlVar1, true)

/process_data/@strNewXml      '<foo name="D">....</foo>'

/process_data/@strXmlVar      concat(substring-before(/process_data/@strXmlVar,


                                    "</assets>",substring-after(/process_data/@strXmlVar, "</assets>"))

/process_data/xmlNewVar       deserialize(/process_data/@strXmlVar)