# XML Code not working

**URL:** <https://forum.kirupa.com/t/xml-code-not-working/222128>\
**Category:** flash\
**Created:** [April 11, 2007, 3:48am UTC](https://forum.kirupa.com/t/xml-code-not-working/222128 "2007-04-11T03:48:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![twistedpixel](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@twistedpixel](https://forum.kirupa.com/u/twistedpixel)\
**Post date:** [April 11, 2007, 3:48am UTC](https://forum.kirupa.com/t/xml-code-not-working/222128/1 "2007-04-11T03:48:45Z")

</div>

Hi,

I got some XML Code off your Website…The interesting thing is that, the code does work for some but refuses to work somewhere else…which is strange…

```auto

//Data.XML
<?xml version="1.0"?>
<disptext>
     <firstcontent>
        <name>Counsellor</name>
     </firstcontent>
     <secondcontent>
        <name>Prince of Peace</name>
     </secondcontent>
     <thirdcontent>
        <name>Saviour</name>
     </thirdcontent>
     <fourthcontent>
        <name>Your Text</name>
     </fourthcontent>
</disptext>

```

The code to display this in Flash is here…

```auto

function loadXML(loaded) { 
if (loaded) { 
//populating the text fields
_root.ftext = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue; 
_root.sectext = this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue; 
_root.thirdtext = this.firstChild.childNodes[2].childNodes[0].firstChild.nodeValue; 
_root.fourthtext = this.firstChild.childNodes[3].childNodes[0].firstChild.nodeValue; 
firsttext.text = _root.ftext; 
secondtext.text = _root.sectext; 
thirdtext.text = _root.thirdtext; 
fourthtext.text = _root.fourthtext; 
} else { 
trace("file not loaded!");; 
} 
} 
xmlData = new XML(); 
xmlData.ignoreWhite = true; 
xmlData.onLoad = loadXML; 
xmlData.load("data.xml"); 

```

What i notice is that, it’s loading the data for the first and second texts…but nothing afterward. I also interchanged the text fields (called the first one on the third), but still no luck.

I don’t have the XML code on the very first frame, it’s halfway down, but is that a problem ?..as 2 of my 4 text fields are updating. I don’t understand why this happens. I hope someone can help me.
