download (the starter files)

Let's begin with the XML file. I'm just going to use the same silly questions and answers that I made up previously, except that I added one more so that there are five questions altogether.

Notice that each item in this file has the same basic structure. There is a question, an answer (the digit that represents the correct answer), and any number of choices. This is the same basic structure that we formerly used in the quiz program, so adapting it shouldn't be very much hassle at all.

Make sure this file is in the same folder as your other quiz files. If you don't have the other quiz files, they're available from the link at the top of this page. The XML file is included in the zip. But if you didn't download it from the link above, you can copy and paste it into a text editor and save it as "quiz.xml." And here it is:
<?xml version="1.0" encoding="utf-8" ?>
<question>What color is an orange?</question>
<question>What is the shape of planet earth?</question>
<question>Who created SpiderMan?</question>
<choice>Jack Kirby</choice>
<choice>Stan Lee and Steve Ditko</choice>
<choice>Stan Lee</choice>
<choice>Steve Ditko</choice>
<choice>none of the above</choice>
<question>Who created Mad?</question>
<choice>Al Feldstein</choice>
<choice>William M. Gaines</choice>
<choice>Jack Davis</choice>
<choice>none of the above</choice>
<question>Who was our first President?</question>
<choice>George Washington</choice>
<choice>John Adams</choice>
<choice>Jack Daniels</choice>
<choice>Skeeter Davis</choice>

We're only going to work on two files: and We're going to make the QuizApp get its data from the XML file, and we're going to make receive an XML object as a parameter instead of the three parameters it gets now. Ready?

P.S. I just realized that the last question I threw in there is kind of US-centric, and this is the Internet. So if you are not in the United States, feel free to change that one to whatever it would be for your country. In fact, change any or all of the questions and make it your quiz!