# Is it possible? Updating single XML node

**URL:** <https://forums.eggplantsoftware.com/t/is-it-possible-updating-single-xml-node/3202>\
**Category:** Eggplant Functional\
**Created:** [December 3, 2012, 1:05pm UTC](https://forums.eggplantsoftware.com/t/is-it-possible-updating-single-xml-node/3202 "2012-12-03T13:05:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erik.Stevens](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/e/49beb7/32.png) [@Erik.Stevens](https://forums.eggplantsoftware.com/u/Erik.Stevens)\
**Post date:** [December 3, 2012, 1:05pm UTC](https://forums.eggplantsoftware.com/t/is-it-possible-updating-single-xml-node/3202/1 "2012-12-03T13:05:05Z")

</div>

I can get the xml into a property list and navigate it to retrieve data, however I was wondering if I could do something similar to the following:

set property Active of each item of Tree to 1 where Name of each is “Testing”

when I try this, I get the following exception:  
FAILURE Invalid Range Only numeric, date/time, and character ranges are supported.  
Execution Time 0:00:00 TestStuff2.script

I’ve tried several different ways to try and make this work in a quick and efficient way, but I can’t seem to find an easy way to do this. Currently my work around is to create another Tree and updating the 1 value while making it, iterating through each value/node.

---

<div class="post-metadata">

**Author:** ![Erik.Stevens](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/e/49beb7/32.png) [@Erik.Stevens](https://forums.eggplantsoftware.com/u/Erik.Stevens)\
**Post date:** [December 19, 2012, 2:37pm UTC](https://forums.eggplantsoftware.com/t/is-it-possible-updating-single-xml-node/3202/2 "2012-12-19T14:37:51Z")

</div>

Right, I guess I didn’t explain my problem well enough or I’m just doing things so wrong that nobody can help. An example of what I’m doing:

```auto
set xml to {{
<iPads>
&lt Pad Name="ErikS" IP="10.0.0.1" Active="true" SUT="" time=""/ &gt
&lt Pad Name="Toms" IP="10.0.0.2" Active="true" SUT="" time=""/ &gt
&lt Pad Name="Jerrys" IP="10.0.0.3" Active="true" SUT="" time=""/ &gt
</iPads>
}} as tree

```

\*It won’t display the attributes of the pad lines I put them in there with \<\>  
Now I want to set ErikS pad to have Active=true, SUT=connectioninfo().Name, and time=the international date && the abbrev time

To do that currently I’m doing:

```auto
repeat with each item of xml
		if it.Name is NAME
			set it.Active to "true"
			set it.SUT to ConnectionInfo().Name
			set it.time to the international date && the abbrev time
			put it into item repeatindex() of xml
		end if
	end repeat

```

Which seems kinda sloppy. I would like to know if there is a quick way to set the attributes of this node. I can easily get them using:

```auto
put each item of xml where name of each is NAME

```

or a specific value using:

```auto
put property Active of each item of xml where name of each is NAME

```

It would be very cool if I could do something like setting these same values using the same logic:

```auto
set property Active of each item of xml where name of each is NAME to VALUE

```

or

```auto
Insert VALUE into property Active of each item of xml where name of each is NAME

```

The [http://docs.testplant.com/?q=content/working-trees-and-xml](http://docs.testplant.com/?q=content/working-trees-and-xml) page wasn’t too helpful with explaining how to set values in cases where I have several branches with the same tag but different attributes. Most of my problems are likely due to the xml structure.
