# Good XML nodes for "flash cards"

**URL:** <https://forum.kirupa.com/t/good-xml-nodes-for-flash-cards/263923>\
**Category:** programming\
**Created:** [June 20, 2008, 2:20pm UTC](https://forum.kirupa.com/t/good-xml-nodes-for-flash-cards/263923 "2008-06-20T14:20:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kuildeous](https://avatars.discourse-cdn.com/v4/letter/k/7bcc69/32.png) [@Kuildeous](https://forum.kirupa.com/u/Kuildeous)\
**Post date:** [June 20, 2008, 2:20pm UTC](https://forum.kirupa.com/t/good-xml-nodes-for-flash-cards/263923/1 "2008-06-20T14:20:29Z")

</div>

Hidey ho, first time here, and I’m liking what I see so far. Very nice tutorials on the site. Wish I came here sooner!

So, as an utter newbie at XML, I am trying to teach myself some AS3 and XML integration by making a flash card program within Flash CS3. I’m not entirely sure what to do within Flash, but I’ll burn that bridge when I get there. For now, I want to set up an XML file that is conducive to flash cards.

After some poking around, I have decided to write the data in the following way:

```auto
 
<?xml version="1.0"?>
<quiz>
<question>
<questionText>The smallest unit structure of living things is the...</questionText>
<choice correct="no">mucous</choice>
<choice correct="no">nucleus</choice>
<choice correct="no">protein</choice>
<choice correct="yes">cell</choice>
</question>
<question>
<questionText>One Greek term meaning back is...</questionText>
<choice correct="no">lateral</choice>
<choice correct="no">ventral</choice>
<choice correct="yes">dorsal</choice>
<choice correct="no">anterior</choice>
</question>
<question>
<questionText>What is the enlargement of the extremities?</questionText>
<choice correct="no">centesis</choice>
<choice correct="yes">acromegaly</choice>
<choice correct="no">paralysis</choice>
<choice correct="no">dermatitis</choice>
</question>
</quiz>

```

So, my question is: Is this a good structure for a flash card? This will go into AS3, but naturally I welcome input from all angles. Who knows what I’ll use for flash cards later on? I’ve never constructed flash cards using XML before, so I’m a little hesitant.

Kevin

---

<div class="post-metadata">

**Author:** ![Anogar](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@Anogar](https://forum.kirupa.com/u/Anogar)\
**Post date:** [June 20, 2008, 5:10pm UTC](https://forum.kirupa.com/t/good-xml-nodes-for-flash-cards/263923/2 "2008-06-20T17:10:16Z")

</div>

Sure, that’s a fine way to do it. :thumb:

---

<div class="post-metadata">

**Author:** ![Kuildeous](https://avatars.discourse-cdn.com/v4/letter/k/7bcc69/32.png) [@Kuildeous](https://forum.kirupa.com/u/Kuildeous)\
**Post date:** [June 20, 2008, 9:23pm UTC](https://forum.kirupa.com/t/good-xml-nodes-for-flash-cards/263923/3 "2008-06-20T21:23:57Z")

</div>

> [@Anogar;2346446](#):
>
> Sure, that’s a fine way to do it. :thumb:

Thank you for that. I want to make sure I do this right the first time. I haven’t gotten to the AS coding yet, but I predict a randomizer that opens a question node. If the answer picked has the attribute correct=“yes” then code is run that puts the question off to the side and moves on. Naturally, if the wrong answer is chosen, then the question is shuffled back in.

I’m sure I’ll be back when I hit my next obstacle, which will probaly be soon. Thanks again for taking a look at it.

Kevin

---

<div class="post-metadata">

**Author:** ![sekasi](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sekasi](https://forum.kirupa.com/u/sekasi)\
**Post date:** [June 20, 2008, 9:26pm UTC](https://forum.kirupa.com/t/good-xml-nodes-for-flash-cards/263923/4 "2008-06-20T21:26:34Z")

</div>

I would probably go attributes all the way tbh…

```auto

<questionText>The smallest unit structure of living things is the...</questionText>
<choice text="mucous" />
<choice text="nucleus" />
<choice text="protein" />
<choice correct="yes"text="cell" />
</question>

```

You the correct=“no” is a bit redundant since you can search for yes… 😮

---

<div class="post-metadata">

**Author:** ![Kuildeous](https://avatars.discourse-cdn.com/v4/letter/k/7bcc69/32.png) [@Kuildeous](https://forum.kirupa.com/u/Kuildeous)\
**Post date:** [June 23, 2008, 1:09pm UTC](https://forum.kirupa.com/t/good-xml-nodes-for-flash-cards/263923/5 "2008-06-23T13:09:22Z")

</div>

Oh, a good point. I’ll give that a shot.

I’m learning so much about XML efficiency already. Thank you kindly.

Kevin

---

<div class="post-metadata">

**Author:** ![Felixz](https://avatars.discourse-cdn.com/v4/letter/f/ecb155/32.png) [@Felixz](https://forum.kirupa.com/u/Felixz)\
**Post date:** [June 23, 2008, 9:00pm UTC](https://forum.kirupa.com/t/good-xml-nodes-for-flash-cards/263923/6 "2008-06-23T21:00:00Z")

</div>

```auto
<question>
<questionText>One Greek term meaning back is...</questionText>
<choices>lateral,ventral,anterior</choices>
<answer>dorsal</answer>
</question>

```

---

<div class="post-metadata">

**Author:** ![Kuildeous](https://avatars.discourse-cdn.com/v4/letter/k/7bcc69/32.png) [@Kuildeous](https://forum.kirupa.com/u/Kuildeous)\
**Post date:** [June 24, 2008, 7:34pm UTC](https://forum.kirupa.com/t/good-xml-nodes-for-flash-cards/263923/7 "2008-06-24T19:34:16Z")

</div>

> [@Felixz;2347937](#):
>
> ```auto
> <question>
> <questionText>One Greek term meaning back is...</questionText>
> <choices>lateral,ventral,anterior</choices>
> <answer>dorsal</answer>
> </question>
> 
> ```

Wow, that is a lot simpler. But I don’t really know what to do with it. I suppose I will kludge through it when I get to the point where I am ready to parse the text, but I’m currently not sure what needs to be done.

I suppose I would assign each button to each of the words (stripping out commas). If a button is assigned to the \<answer\> node, then I call the function for choosing the right answer. I’ll take a look at this. Thanks very much.

Kevin

---

<div class="post-metadata">

**Author:** ![DiamondDog](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@DiamondDog](https://forum.kirupa.com/u/DiamondDog)\
**Post date:** [June 24, 2008, 7:55pm UTC](https://forum.kirupa.com/t/good-xml-nodes-for-flash-cards/263923/8 "2008-06-24T19:55:04Z")

</div>

Just wondering if it would be even simpler if you wrote the XML file in such a way that the correct answer always appeared first in the list of choices.

Obviously, there would need to be some sort of shuffling when you displayed the question (people might catch on otherwise 🙂 ) but it would make your XML structure simpler - no need for an answer element.

---

<div class="post-metadata">

**Author:** ![Felixz](https://avatars.discourse-cdn.com/v4/letter/f/ecb155/32.png) [@Felixz](https://forum.kirupa.com/u/Felixz)\
**Post date:** [June 24, 2008, 11:54pm UTC](https://forum.kirupa.com/t/good-xml-nodes-for-flash-cards/263923/9 "2008-06-24T23:54:12Z")

</div>

u can use

```auto
String("lateral,ventral,anterior").split(",")

```

to get an array of those answers
