xml Calendar

admin

Administrator
Staff member
I'm attempting to create a list of events by importing XML into a webpage.

The xml code is valid but the problem is displaying it.
I want to be able to show the same xml code on a number of sites and load it into the html directly from the xml (so as not to have to update each page everytime a new event is added).

I would also like to manipulate one of the items.
To make this next point clearer, Here is an example of the xml code.

<?xml version="1.0"?>
<events>
<event>
<bignum>20050304</bignum>
<date>March 03, 2005</date>
<data>Pie eating contest</data>
</event>
<event>
<bignum>20050405</bignum>
<date>April 04, 2005</date>
<data>Night at the Docks</data>
</event>
<event>
<bignum>20050425</bignum>
<date>April 25, 2005</date>
<data>Ski Trip</data>
</event>
</events>

I want to check the value of <bignum> and if it is larger than a certain value not display it on some pages. I figure the easiest way to do this would be to load all the values into an array on the html page using javascript but I don't know how to write that code.

I am also entertaining the possibility of at a later time using the xml info to aid in creating a calendar that would dynamically load the new events.

my idea so far for implementing this would be something like:

/* code to load the xml file itself */

<script>
var happenings=[[],[]];
for (x=0, x<events.length, x++)
{
/* that probably isn't the correct way to call the event things. what is? */
happenings[x][0]=event[x].bignum;
happenings[x][1]=event[x].date;
happenings[x][2]=event[x].data;
}

for (r=0, r<happenings.length, r++)
{
document.write("Event: "happenings[x][2]+"<br>Date: "+happenings[x][1]);
}
</script>

I know I'm missing something there. Any help would be greatly apprecaiated. Cheers,
 
Back
Top