Return to Snippet

Revision: 33087
at October 6, 2010 01:56 by heathbo


Initial Code
Example XML code:

<question id = "a3" incorrectFeedBackID = "18190" correctFeedbackID = "18189">
	<answer id = "18183" isCorrect = "false"></answer>
	<answer id = "18184" isCorrect = "true"></answer>
	<answer id = "18185" isCorrect = "true"></answer>
	<answer id = "18186" isCorrect = "false"></answer>
	<answer id = "18187" isCorrect = "true"></answer>
	<answer id = "18188" isCorrect = "true"></answer>
</question>

<question id = "a5" incorrectFeedBackID = "18199" correctFeedbackID = "18198">
	<answer id = "18192" isCorrect = "false"></answer>
	<answer id = "18193" isCorrect = "true"></answer>
	<answer id = "18194" isCorrect = "true"></answer>
	<answer id = "18195" isCorrect = "true"></answer>
	<answer id = "18196" isCorrect = "false"></answer>
	<answer id = "18197" isCorrect = "true"></answer>
</question>
___________________________________________________________________
To get the incorrectFeedBackID for a5:

trace("incorrectFeedBackID:", xml["question"][1].@incorrectFeedBackID);
or
trace(xml.question.(@id == "a5").@incorrectFeedBackID);
___________________________________________________________________
To get the isCorrect value for 18193 in question a5:

trace("isCorrectValue:", xml["question"][1]["answer"][1].@isCorrect);
or
trace(xml.question.(@id == "a5").answer.(@id == "18193").@isCorrect);

Initial URL


Initial Description
How to drill down to the content you need in an XML file.

Initial Title
Parse XML files

Initial Tags


Initial Language
ActionScript 3