# Help with quiz in XML

**URL:** https://forum.kirupa.com/t/help-with-quiz-in-xml/201905
**Category:** Uncategorized
**Created:** [September 26, 2006, 4:04am UTC](https://forum.kirupa.com/t/help-with-quiz-in-xml/201905 "2006-09-26T04:04:03Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ejewels52](https://avatars.discourse-cdn.com/v4/letter/e/f04885/32.png) [@ejewels52](https://forum.kirupa.com/u/ejewels52)
#### Post date: [September 26, 2006, 4:04am UTC](https://forum.kirupa.com/t/help-with-quiz-in-xml/201905/1 "2006-09-26T04:04:03Z")

</div>

Hello-  
So I am trying (key word trying) to develop a quiz using XML…I want to bring the questions and answers in via XML…but am having trouble doing it. I want the XML to be like this:

\<?xml version=“1.0” encoding=“utf-8” standalone=“yes”?\>  
\<quiz\>  
\<question text=“What type of pen tip do you like to write with?”\>  
\<answer1\>Fountain Tip\</answer1\>  
\<answer2\>Rounded Tip\</answer2\>  
\<answer3\>Square Tip\</answer3\>  
\<answer3\>Felt Tip\</answer3\>  
\</question\>  
\<question text=“What type of pen color do you like?”\>  
\<answer1\>red\</answer1\>  
\<answer2\>green\</answer2\>  
\<answer3\>yellow\</answer3\>  
\<answer3\>blue\</answer3\>  
\</question\>  
\<question text=“What is your favorite pen style?”\>  
\<answer1\>Classic\</answer1\>  
\<answer2\>Modern\</answer2\>  
\<answer3\>Stupid\</answer3\>  
\<answer3\>Dummies\</answer3\>  
\</question\>  
\</quiz\>

function parse(sucess) {  
if (sucess) {  
root = this.firstChild;  
question = root.firstChild;  
questions = [];  
answers = [];  
for (i=1; i \< root.length; i++; ) {  
questions\* = question.attributes.text;  
answers\* = question.childNodes[0].firstChild;  
trace(questions);  
trace(answers);  
}  
} else {  
trace(“Loading Failed…”);  
}  
}

xmlText = new XML();  
xmlText.ignoreWhite = true;  
xmlText.onLoad = parse;  
xmlText.load(“text.xml”);

When I publish…I get undefined and it doesn’t all work. all I want to do is to be able to bring in all outside information and use it appropriately…anyone ever do something like this before? A quiz with multiple choice answers that are clickable?
