# Replacing XML Node and Element text in XML

**URL:** <https://forum.kirupa.com/t/replacing-xml-node-and-element-text-in-xml/297492>\
**Category:** flash\
**Created:** [October 3, 2009, 4:43am UTC](https://forum.kirupa.com/t/replacing-xml-node-and-element-text-in-xml/297492 "2009-10-03T04:43:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zik80](https://avatars.discourse-cdn.com/v4/letter/z/c37758/32.png) [@zik80](https://forum.kirupa.com/u/zik80)\
**Post date:** [October 3, 2009, 4:43am UTC](https://forum.kirupa.com/t/replacing-xml-node-and-element-text-in-xml/297492/1 "2009-10-03T04:43:48Z")

</div>

I am stuck on how to make these changes to an xml using AS3. My xml structure is as follows:

```auto

<boys>
 <boy>
  <boyid>1-0</boyid>
  <fname>John</fname>
  <lname>Smith</lname>
  <phone>222-1111</phone>
 </boy>
 <boy>
  <boyid>1-1</boyid>
  <fname>Len</fname>
  <lname>Kandy</lname>
  <phone>222-2222</phone>
 </boy>
 <boy>
  <boyid>1-2</boyid>
  <fname>Het</fname>
  <lname>Plain</lname>
  <phone>222-3333</phone>
 </boy>
 <boy>
  <boyid>1-3</boyid>
  <fname>Ron</fname>
  <lname>Yuko</lname>
  <phone>222-4444</phone>
 </boy>
</boys>

```

2 things I want to do here:

1. Replace node 3 with the following:

```auto

<boy>
 <boyid>1-2a</boyid>
 <fname>Ronald</fname>
 <lname>Yukofin</lname>
 <phone>333-4433</phone>
</boy>

```

1. Replace node 2 element with:

```auto
<phone>123-4567</phone>

```

instead of

```auto
<phone>222-2222</phone>

```

Thanks in advance.
