PDA

View Full Version : XML Loop: displaying MULTIPLE events



marius
October 21st, 2005, 10:02 AM
I have the following XML. Currently it is only pulling one event item from xml data source. I would like to add the ability to pull multiple events listed on the same day.

XML structure:

<year value="2005">
<month value="10">
<day value="20">
<label>Test</label>
<description></description>
</day>
<day value="20">
<label>Test</label>
<description>details...</description>
</day>
</month>
</year>
</calendar>

Code that I am modifying:

_root.dayNode_xml=monthNode_xml.firstChild;
_root.dayNode_xml=setDay(_root.dayNode_xml,1,"square1");


Researching I found this code and I'm pretty sure formatted correctly this is the answer to my issues:

if (topLevel != null)
{
for (i = 0; i <= topLevel.childNodes.length; i++)
{
if (topLevel.childNodes[i].nodeName == "mp3file")
{
var track = topLevel.childNodes[i].attributes["track"];

marius
October 21st, 2005, 12:20 PM
<day value="21">
<label>Test</label>
<description>1</description>
</day>

Okay maybe this will help... How should I format my XML to allow for multiple events in the same day? Difficulty for me lies in making sure each description goes with the correct label...