# XML trouble

**URL:** https://forum.kirupa.com/t/xml-trouble/64611
**Category:** flash
**Created:** [September 17, 2004, 11:06pm UTC](https://forum.kirupa.com/t/xml-trouble/64611 "2004-09-17T23:06:53Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![UC\_PRO](https://avatars.discourse-cdn.com/v4/letter/u/c68b51/32.png) [@UC\_PRO](https://forum.kirupa.com/u/UC_PRO)
#### Post date: [September 17, 2004, 11:06pm UTC](https://forum.kirupa.com/t/xml-trouble/64611/1 "2004-09-17T23:06:53Z")

</div>

This what I got so far

[COLOR=Red]\<eqid\>  
\<id1\>  
\<id\>41\</id\>   
\<desc\>TEST\</desc\>  
\<serial\>123456\</serial\>  
\</id1\>  
\</eqid\>[/COLOR]

and the AS that I was trying to do is:

[COLOR=Blue]function loadXML(loaded) {

if (loaded) {

\_root.eqid= this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;  
\_root.desc= this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;  
\_root.serial= this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;  
id.text = \_root.eqid;  
desc.text = \_root.desc;  
serial.text = \_root.serial;  
} else {  
trace(“file not loaded!”);;

}

}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“structure.xml”);  
[/COLOR]

the problem I think I have is the firstChild directions…please help, I did the tut on your site [http://www.kirupa.com/developer/actionscript/xmldataflash.htm](http://www.kirupa.com/developer/actionscript/xmldataflash.htm)  
and still dont understand the direction from tree to branch…you got in your AS inventor as root and comment as root, that doent make much sense to me. Isnt comment a node instead of a root ?

thanks in advance!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 18, 2004, 11:28am UTC](https://forum.kirupa.com/t/xml-trouble/64611/2 "2004-09-18T11:28:34Z")

</div>

another question is, is it possiable to enable flash to write to a xml file?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 18, 2004, 11:42am UTC](https://forum.kirupa.com/t/xml-trouble/64611/3 "2004-09-18T11:42:32Z")

</div>

1. welcome to Kirupa! :pleased:
2. 

````auto
 and 
```php
 tags help make code more legible and thereby help people understand the code better thereby helping them better answer your question.
3) ... you really didn't have a question :huh: You just gave some code and said you think the problem is... ? What exactly is the question again?
4) did you know that you are assigning equid, desc and serial all to the same value ( this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue; ) ?
5) also, I hope the desc and serial textfields are not in _root since you just defined variables in _root with the same name. You'd then have no way to distinguish between the two.

:)
````

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 18, 2004, 4:18pm UTC](https://forum.kirupa.com/t/xml-trouble/64611/4 "2004-09-18T16:18:44Z")

</div>

Ok, that made no sense!..or just maybe I’m so far in left feild…
