Add an attribute to a child node using Update XML action

  • 6 October 2016
  • 2 replies
  • 11 views

Badge +2

Is there any way to add an attribute to a child node in an xml using update xml action.

my xml is like this below....i just want to add type="System.String" to <Status> node

 

i want to add an attribute to status node 

<?xml version="1.0" encoding="utf-8"?><RepeaterData><Version /><Items><Item><Level type="System.Int32">0</Level><IsCC type="System.Boolean">False</IsCC><Status></Status></Item><Item><Level type="System.Int32">0</Level><IsCC type="System.Boolean">False</IsCC><Status></Status></Item></Items></RepeaterData>

2 replies

Userlevel 5
Badge +14

it looks there's no direct possibility.

if status nodes are always empty and with no attributes as in the example, you could do it with update XML action and replace node option (replace whole status node).

if they can contain data or other attributes you might need to use string replace() or regular expression replace.

Badge +2

I didn’t find replace node option using update xml. I used string replace function to replace the node attribute. Thanks for the different thought

Regards

Rajesh

Reply