zheeka
08-25-2010, 10:45 AM
Hello folks!
Sorry, I'm a noob, and despite going through a tutorial about the use of .xml, I'm just tapping blindly in the dark....
I have a simple (i think..) .xml script containing data about a song that is now being played on a radio station, from wich I have to "extract" the artist and the song title.
The file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Schedule System="Jazler">
<Event status="happening" startTime="14:33:38" eventType="song">
<Announcement Display="Now On Air:"/>
<Song title="Stranger in Moscow(Tee's in-house club mix)">
<Artist name="MICHAEL JACKSON">
</Artist>
<Jazler ID="xxxxx"/>
<PlayLister ID=""/>
<Media runTime="00:06:41"/>
<Expire Time="14:40:18"/>
</Song>
</Event>
</Schedule>
I've tryed with a script looking like this:
<html>
<body>
<p><b>Artist:</b> <span id="artist"></span><br />
<b>Pjesma:</b> <span id="song"></span><br />
<script type="text/javascript">
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","NowOnAir.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
document.getElementById("song").innerHTML=
xmlDoc.getElementsByTagName("song")[0].childNodes[0].nodeValue;
document.getElementById("artist").innerHTML=
xmlDoc.getElementsByTagName("artist")[0].childNodes[0].nodeValue;
</script>
</body>
</html>
What am I doing wrong?
Thnx in advance!
Sorry, I'm a noob, and despite going through a tutorial about the use of .xml, I'm just tapping blindly in the dark....
I have a simple (i think..) .xml script containing data about a song that is now being played on a radio station, from wich I have to "extract" the artist and the song title.
The file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Schedule System="Jazler">
<Event status="happening" startTime="14:33:38" eventType="song">
<Announcement Display="Now On Air:"/>
<Song title="Stranger in Moscow(Tee's in-house club mix)">
<Artist name="MICHAEL JACKSON">
</Artist>
<Jazler ID="xxxxx"/>
<PlayLister ID=""/>
<Media runTime="00:06:41"/>
<Expire Time="14:40:18"/>
</Song>
</Event>
</Schedule>
I've tryed with a script looking like this:
<html>
<body>
<p><b>Artist:</b> <span id="artist"></span><br />
<b>Pjesma:</b> <span id="song"></span><br />
<script type="text/javascript">
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","NowOnAir.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
document.getElementById("song").innerHTML=
xmlDoc.getElementsByTagName("song")[0].childNodes[0].nodeValue;
document.getElementById("artist").innerHTML=
xmlDoc.getElementsByTagName("artist")[0].childNodes[0].nodeValue;
</script>
</body>
</html>
What am I doing wrong?
Thnx in advance!