# Hello all. I need some Help with my XML code

**URL:** <https://forum.kirupa.com/t/hello-all-i-need-some-help-with-my-xml-code/212537>\
**Category:** flash\
**Created:** [January 11, 2007, 8:53pm UTC](https://forum.kirupa.com/t/hello-all-i-need-some-help-with-my-xml-code/212537 "2007-01-11T20:53:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Motorman007](https://avatars.discourse-cdn.com/v4/letter/m/ec9cab/32.png) [@Motorman007](https://forum.kirupa.com/u/Motorman007)\
**Post date:** [January 11, 2007, 8:53pm UTC](https://forum.kirupa.com/t/hello-all-i-need-some-help-with-my-xml-code/212537/1 "2007-01-11T20:53:05Z")

</div>

hello all,

I need some help loading xml into flash.

I made a flash test for work, but I loaded the text the hard way by doing this:

loadVariables(“text/testQ/36/question36.txt”, this);

loadVariables(“text/testQ/36/answer36.txt”, this);

Each Question and each answer are in its on folder which makes a total of 40 folders.

Is it way to load the text in each field by using xml?

I was think of doing like this

File names is test.xml

\<?xml version=“1.0” encoding=“iso-8859-1”?\>  
\<Test\>  
\<item question=“1. How to delay an action without crashing the Flash player” answer=“a. 61 b. 65 c. 121” /\>  
\</items\>

Should I make Array’s

Like so  
var nodes:Array = new Array();  
var question:Array = new Array();  
var answers:Array = new Array();

var sXML:XML = new XML();  
sXML.ignoreWhite = true;  
sXML.onLoad = test;  
sXML.load(“test.xml”);

then

function test(){  
nodes = this.firstChild.childNodes;  
for (i=0; i\<nodes.length; i++){

/_textbox name —question\_txt—  
` ----answer\_txt—_/  
Then code for text field

question\_txt.push(nodes\*.attributes.question);  
answer \_txt.push(nodes\*.attributes.answer);

}  
}

sXML.load(“test.xml”);

thanx for the help

Motor
