# XML: AppendChild

**URL:** <https://forum.kirupa.com/t/xml-appendchild/226764>\
**Category:** flash\
**Created:** [May 23, 2007, 8:40pm UTC](https://forum.kirupa.com/t/xml-appendchild/226764 "2007-05-23T20:40:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![costa](https://avatars.discourse-cdn.com/v4/letter/c/85f322/32.png) [@costa](https://forum.kirupa.com/u/costa)\
**Post date:** [May 23, 2007, 8:40pm UTC](https://forum.kirupa.com/t/xml-appendchild/226764/1 "2007-05-23T20:40:18Z")

</div>

Dear all,

I have been dealing with this error for two days. Basically if I have a “for in” loop, that collects all items on stage and put their information in a XML var.

```auto
var myRows: XML = <&#8230;>// this XML var is initialized with some lines

for (var i:int =0; i<this.numChildren; i++) {
.
myRows.rows.(@id == pointer).appendChild(newNode);
.
}

```

where myRows is my XML var, (@id == pointer) is a filter to put items in a specific position and newNode is the new node (information of the items) I want to add.

So far everything is fine but when I try to add more than two items in a same cycle of the “for in” I got this error

```auto
TypeError: Error #1086: The appendChild method only works on lists containing one item.

```

For example:

```auto
var myRows: XML = <&#8230;>// this XML var is initialized with some lines
for (var i:int =0; i<this.numChildren; i++) {
.
myRows.rows.(@id == pointer).appendChild(newNode);
myRows.rows.(@id == pointer + 1).appendChild(newNode);
.
}

```

or

```auto
var myRows: XML = <&#8230;>// this XML var is initialized with some lines
for (var i:int =0; i<this.numChildren; i++) {
.
for (var i:int = 0; i<3; i++){
     myRows.rows.(@id == pointer +i).appendChild(newNode);
.
}

```

Do you have any idea what I am doing wrong.

Thanks in advance
