# XML Data Displayer, help adding multiple data fields relating to XML

**URL:** <https://forum.kirupa.com/t/xml-data-displayer-help-adding-multiple-data-fields-relating-to-xml/243226>\
**Category:** flash\
**Created:** [November 4, 2007, 6:00pm UTC](https://forum.kirupa.com/t/xml-data-displayer-help-adding-multiple-data-fields-relating-to-xml/243226 "2007-11-04T18:00:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![viiespk](https://avatars.discourse-cdn.com/v4/letter/v/ed655f/32.png) [@viiespk](https://forum.kirupa.com/u/viiespk)\
**Post date:** [November 4, 2007, 6:00pm UTC](https://forum.kirupa.com/t/xml-data-displayer-help-adding-multiple-data-fields-relating-to-xml/243226/1 "2007-11-04T18:00:32Z")

</div>

I recently used the Displaying XML Data tutorial, but cant seem to figure out how to add more dynamic text fields and populate them with more \<person\> and \<comment\> attributes.

Here is my code:

function loadXML(loaded) {  
if (loaded) {  
\_root.inventor = this.firstChild.childNodes[2].childNodes[0].firstChild.nodeValue;  
\_root.comments = this.firstChild.childNodes[2].childNodes[1].firstChild.nodeValue;  
name\_txt.text = \_root.inventor;  
comment\_txt.text = \_root.comments;  
} else {  
content = “file not loaded!”;  
}  
}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“inventors.xml”);

and xml:

\<?xml version=“1.0”?\>

\<inventors\>  
\<person\>  
\<name\>Thomas Edison\</name\>  
\<comment\>Inventor of many things such as the incandescent lightbulb.\</comment\>  
\</person\>  
\<person\>  
\<name\>Doug Engelbart\</name\>  
\<comment\>Invented the mouse at the Stanford Research Institute\</comment\>  
\</person\>  
\<name\>Patrick\</name\>  
\<comment\>did this xml file\</comment\>

```
&lt;/person&gt;

```

\</inventors\>

I am trying to display Patrick - and did this xml file.

Could you please help me figure out what I am doing wrong here?
