How to read xml using scripting ?
Are you looking for a way to read xml using scripting ? then read this thread to know how to read it
below is the code what i want is date ,time,day,year is coming which are in xml file but message in xml not coming for ex xmlfile is
<Staff>
<month>12</month>
<date>31</date>
<message>"If you are ready to believe, you are easy to deceive" </message>
</Staff>
<Staff>
<month>12</month>
<date>30</date>
<message>"Before you can score you must first have a goal." </message>
</Staff>
<Staff>
<month>12</month>
<date>29</date>
<message>"Before you can score you must first have a goal." </message>
</Staff>
??this is xml file//
////this is html////
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<meta http-equiv="refresh" content="3600" />
<script language="javascript" type="text/javascript">
calendar = new Date();
day = calendar.getDay();
month = calendar.getMonth();
date = calendar.getDate();
year = calendar.getYear();
if (year < 1000)
year+=1900
cent = parseInt(year/100);
g = year % 19;
k = parseInt((cent - 17)/25);
i = (cent - parseInt(cent/4) - parseInt((cent - k)/3) + 19*g + 15) % 30;
i = i - parseInt(i/28)*(1 - parseInt(i/28)*parseInt(29/(i+1))*parseInt((21-g)/11));
j = (year + parseInt(year/4) + i + 2 - cent + parseInt(cent/4)) % 7;
l = i - j;
emonth = 3 + parseInt((l + 40)/44);
edate = l + 28 - 31*parseInt((emonth/4));
emonth;
var dayname = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var monthname = new Array ("January","February","March","April","May","June","July","August","September","October","November","December" );
//>
</script>
<script type="text/javascript">
var xmlDoc=null;
if (window.ActiveXObject){
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
else if (document.implementation.createDocument){
xmlDoc=document.implementation.createDocument("","",null);
}
else{
alert('Browser cannot handle this script');
}
if (xmlDoc!=null){
xmlDoc.async=false;
xmlDoc.load("xml");
var x=xmlDoc.getElementsByTagName("message");
var i;
}
</script>
<script language="javascript">
window.onload = function ()
{
this will hide the scroll bar
document.getElementsByTagName("body")[0].style.overflow = "hidden";
}
</script>
<style>
marquee { font-family:arial; color:#ffffff; font-weight:bold; font-size:54px; text-align:left; height: 100px; padding-top:25px; border: 2px white solid}
.logo { font-family:arial; color:#ffffff; font-size:45px; text-align:left; height: 100px; padding-top:2px; border: 2px white solid}
</style>
</HEAD>
<BODY leftMargin='0' topMargin='0' rightmargin ='0' bgcolor="#000000">
<table border='00' cellpadding='0' cellspacing='0' width=0 height=0 align="left">
<tr>
<td align="center" colspan='2' valign="top">
<script type="text/javascript">
var slideimages=new Array()
var slidelinks=new Array()
var currentTime = new Date()
var day = currentTime.getDay()
var date = currentTime.getDate()
var message = currentdate.getmessage()
function slideshowimages(){
for (i=1,j=0;i<slideshowimages.arguments.length;i++){
if(i<=9|| i-9==date)
{
slideimages[j]=new Image()
slideimages[j].src=slideshowimages.arguments[i-1]
j++
}
}
}
//>
</script>
<a href="javascript:gotoshow()"><img src="ektha1.jpg" name="slide" border=0 width=152% height=550></a>
<script>
<!
//configure the paths of the images, plus corresponding target links
slideshowimages("ektha1.jpg","ektha2.jpg","ektha3.jpg","ektha4.jpg","ektha5.jpg","ektha6.jpg","ektha7.jpg","ektha8.jpg","ektha9.jpg","01.JPEG","02.JPEG","03.JPEG","04.JPEG","05.JPEG","06.JPEG","07.JPEG","08.JPG","09.JPEG","10.JPEG","11.JPEG","12.JPEG","13.JPEG","14.JPEG","15.JPEG","16.JPEG","17.JPEG","18.JPEG","19.JPEG","20.JPEG","21.JPEG","22.JPEG","23.JPEG","24.JPEG","25.JPEG","26.JPEG","27.JPEG","28.JPEG","29.JPEG","30.JPEG","31.JPEG")
//configure the speed of the slideshow, in miliseconds
var slideshowspeed=1000
var whichlink=0
var whichimage=0
function slideit(){
if (!document.images)
return
document.images.slide.src=slideimages[whichimage].src
whichlink=whichimage
if (whichimage<slideimages.length-1)
{
whichimage++
}
else
whichimage=0
setTimeout("slideit()",slideshowspeed)
}
slideit()
//>
</script>
<td valign="top" hspace=10 vspace=10&>
<script language="javascript" type="text/javascript">
var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
var thetime = new Date();
var themonth = thetime.getMonth();
var theday = thetime.getUTCDate();
var themessage = thedate.getmessage();
//var myimage =0;
//imageView.image= null;
//myimage.onerror = function() { this.style.visibility = 'hidden'; }
var m='<img src="' + months[themonth] + ''+theday+'.jpg">';
document.write(m);
document.write(theday);
if(m.exists)
document.write('<img src="' + months[themonth] + ''+theday+'.jpg" alt="Image of the month: ' + months[themonth] + ' " width="155" height="1000" '+message+' />');
(function(){
var allimgs = document.images;
for(var i=0; i<allimgs.length; i++){
allimgs[i].onerror = function () {
this.style.visibility = "hidden"; // other elements not affected
}
document.write('<html><body>');
document.write('<br/>');
//document.write('<img src="bday6.jpg" width="270" height="300" />');
</script>
<head>
<meta http-equiv="refresh" content="800" />
</head>
<! <% If (now - #1/1/2012# < maxdays) Then %>
<img src="C:/Documents and Settings/Administrator.IM.000/Desktop/Copy of sss5/january4.jpg" width=350 height=250>
<% End If %>>
</td>
</tr>
<tr>
<td width='10px' height = '100px' bgcolor='#000055' border =30 class='logo'> ektha</td>
<td><marquee style="font-family:arial; color: #FFFFFF" bgcolor="#990000" scrollamount="20" width='160%'>
<SCRIPT>
//document.body.style.overflow = 'hidden';
document.write(dayname[day] + ", ");
document.write(monthname[month] + " ");
document.write(date + ", ");
document.write(year + ", ");
// January
i = 0;
for (i=0;i<x.length;i++)
{
//alert(i);
//alert(month);
var x=null;
var y=null;
var z=null;
var Z=null;
var d=new Date();
var monthNumber = d.getMonth()+1;
var nodes =xmlDoc.getElementsByTagName("Staff");
for(j=0;j<nodes.length;j++)
{
x=xmlDoc.getElementsByTagName("month")[j]
y=x.childNodes[0];
z=xmlDoc.getElementsByTagName("date")[j]
Z=z.childNodes[0];
if(monthNumber==y.nodeValue)
{
if(date==Z.nodeValue)
{
var message = xmlDoc.getElementsByTagName("message")[j] ;
var Message = message.childNodes[0];
document.write( emp1.xmldoc.Message);
}
}
}
}
//if ((month == monthname[month]) && (date == date))
//document.write(" Happy Birthday To " +x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue);
</SCRIPT>
</marquee> </td>
</tr>
</TABLE>
</BODY>
</HTML>