I'm creating a quiz for the game using Animate CC, all of my questions and answers were taken from XML file. I have 3 categories in the quiz, each of them has 4 questions. 2 of them are working fine, but one has an error. Then I got received this error:
TypeError: Error #1085: The element type "opi1" must be terminated by the matching end-tag "</opi1>".
at RelationCon/loadXML()[RelationCon::frame10:13]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
Here's my code from frame 10:
import flash.net.URLLoader;
import flash.net.URLRequest;
var questioni: Array = new Array();
var answeri: Array = new Array();
var koreki: Array = new Array();
var loader3: URLLoader = new URLLoader();
loader3.addEventListener(Event.COMPLETE, loadXML);
loader3.load(new URLRequest("relations.xml"));
function loadXML(event: Event): void {
var myxml3 = new XML(event.target.data);
var loopo = myxml3.quesh.length();
for (var i = 0; i < loopo; i++) {
questioni[i] = myxml3.quesh[i].qt1;
answeri[i] = [myxml3.quesh[i].opi1, myxml3.quesh[i].opi2, myxml3.quesh[i].opi3];
koreki[i] = myxml3.quesh[i].opi1;
}
gotoAndPlay(11);
}
Here's from line 13:
var myxml3 = new XML(event.target.data);
And here's my code from XML file:
<?xml version="1.0" encoding="UTF-8"?>
<all>
<quesh>
<qt1>A relation can be represented using a ___________.</qt1>
<opi1>Directed graph</opi>
<opi2>Indirected graph</opi2>
<opi3>Bar graph</opi3>
</quesh>
<quesh>
<qt1>A type of relation on set X is the set {(x, x)|x ? X}.</qt1>
<opi1>Identity</opi1>
<opi2>Symmetry</opi2>
<opi3>Empty</opi3>
</quesh>
<quesh>
<qt1>A relation R on a set A called ___ if ?a?A is related to a.</qt1>
<opi1>Reflexive</opi1>
<opi2>Asymmetry</opi2>
<opi3>Symmetry</opi3>
</quesh>
<quesh>
<qt1>A relation R on set A is called ___________ if xRy and yRx implies x = y ?x ? A and ?y ? A.</qt1>
<opi1>Anti-symmetric</opi1>
<opi2>Reflexive</opi2>
<opi3>Identity</opi3>
</quesh>
</all>
Both codes seem right, but I don't think why I received this error. Is there something wrong with those codes that I've given? Any help will appreciated. Thanks!
<opi1>Directed graph</opi>
is invalid, because the opening and closing tag do not match. One has a 1 at the end while the other does not.