Expand my Community achievements bar.

Add second element into an xml object

Avatar

Level 3

Hi,

I can do a set value into an xml object to create a new element with a value. This is simple, I can do it this way:

/process_data/myxmlvar/myvar     =    '123'

This will give me an xml which looks something like this:

<myxmlvar>

     <myvar>123</myvar>

</myxmlvar>

Now I want to add a second "myvar" element, basically turning it into an array. But I can't find a way to do this in a set value. I know it's possible to do this using an XSLT Transformation, but I'd much rather just do it inside a set value if that's possible.

Just to clear any possible doubt, here's what I'm trying to get the output to look like:

<myxmlvar>

     <myvar>123</myvar>

     <myvar>456</myvar>

</myxmlvar>

Thanks

Nic

2 Replies

Avatar

Level 3

Thanks for the suggestion, although this would probably achieve what I'm aiming for I thought it might be a bit difficult to maintain. So in the end I used XSLT to modify my XML.

Thanks

Nic