...

View Full Version : XML parsing error? Repetition



gilgalbiblewhee
08-27-2008, 05:58 PM
I don't understand but my XML is repeated as I parse it with AJAX. There is a repetition (x2) of nodes:
http://205.205.200.231/~h806209/blog.xml


<script type="text/javascript">
function parseXML(){
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
xmlDoc=document.implementation.createDocument("","",null);
}
catch(e)
{
alert(e.message);
return;
}
}
xmlDoc.async=false;
xmlDoc.load("blog.xml");
//document.getElementById("biotext").innerHTML=xmlDoc.getElementsByTagName("blog7708")[0].childNodes[0].nodeValue;
blogXml= document.getElementById("picbar");
var m;
var months = new Array();
months[0] = "January";
months[1] = "February";
months[2] = "March";
months[3] = "April";
months[4] = "May";
months[5] = "June";
months[6] = "July";
months[7] = "August";
months[8] = "September";
months[9] = "October";
months[10] = "November";
months[11] = "December";

for(m=0; m<months.length; m++){
if(xmlDoc.getElementsByTagName(months[m]).length > 0)
for(i=0; i<xmlDoc.getElementsByTagName(months[m]).length; i++){
blogXml.innerHTML+="<span style='font-weight: bold; font-family: Verdana, Arial, Times New Roman; border: 1px solid #BCB2B3; display: block; background-color:#FFFFAE; padding: 5px;'>"+ months[m] + " " + xmlDoc.getElementsByTagName(months[m])[i].getAttribute("date")+ ", " + xmlDoc.getElementsByTagName("year")[0].getAttribute("number")+"</span>";
blogXml.innerHTML+="<br /><br />";
blogXml.innerHTML+="<span style='font-weight: normal; font-family: Verdana, Arial, Times New Roman; display: block; padding: 10px;'>" + xmlDoc.getElementsByTagName(months[m])[i].childNodes[0].nodeValue+"</span>";
blogXml.innerHTML+="<br /><br />";
} // endfor i
} // endif
} // endfor m
</script>

<div id="picbar" style="clear: left; margin: 0px 0px 10px 0px; border: none; background-color: #FFCC00; width: 200px; min-height: 390px; overflow-y: scroll;"></div>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum