Skip to main content

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>

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.


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