View Full Version : New to XML, Need help speeding this up.
Tanker
01-07-2003, 06:40 PM
I have a cold fusion generated XML page which runs quickly, then I have an htm page that uses javascript to pull the information from the xml page and format it so it looks like the rest of the site. (not same site, eventually it will pull the xml from my site across the net).
http://www.tankyard.com/isen/xmembers.cfm - Is the page that generates the XML , pretty quick response.
http://www.tankyard.com/isen/xmembers.htm - Is the page that reads the xml and formats it.
If someone could look at the code and offer some suggestions on how to speed it up, and make it NS compatible it would be appreciated. I'm new to XML and pieced the htm/javascript parser together from what I found on the net.
Thanks in advance.
since you already have cold fusion why not just use that? to me it seems like your going out of your way to use xml and javascript.
if you are set on doing it this way i could only see a few things that you could improve upon. you have a lot of document.write statements that dont need to be there.
for example look at this code
if(cName != xmlDoc.getElementsByTagName("member")[i].childNodes[0].firstChild.nodeValue){
document.write("<tr valign='top'><td height='15' colspan='9' bgcolor='#008080' align='center'><b>" + xmlDoc.getElementsByTagName("member")[i].childNodes[0].firstChild.nodeValue + "</b></td></tr>")
document.write("<tr>")
document.write("<td height='15'> </td>")
document.write("<td width='172' height='15'><b>Name</b></td>")
document.write("<td width='74' height='15'><b>Title</b></td>")
document.write("<td width='45' height='15'><b>Level</b></td>")
document.write("<td width='37' height='15'><b>Epic</b></td>")
document.write("<td width='37' height='15'><b>Race</b></td>")
document.write("<td width='37' height='15'><b>Sex</b></td>")
document.write("<td width='125' height='15'><b>Keys</b></td>")
document.write("<td width='125' height='15'><b>Main</b></td>")
document.write("</tr>")
cName = xmlDoc.getElementsByTagName("member")[i].childNodes[0].firstChild.nodeValue;
}
that could be optimized to this
if(cName != xmlDoc.getElementsByTagName("member")[i].childNodes[0].firstChild.nodeValue){
var infoTable="<tr valign='top'><td height='15' colspan='9' bgcolor='#008080' align='center'><b>" + xmlDoc.getElementsByTagName("member[i].childNodes[0].firstChild.nodeValue + "</b></td></tr><tr><td height='15'> </td><td width='172' height='15'><b>Name</b></td><td width='74' height='15'><b>Title</b></td><td width='45' height='15'><b>Level</b></td><td width='37' height='15'><b>Epic</b></td><td width='37' height='15'><b>Race</b></td><td width='37' height='15'><b>Sex</b></td><td width='125' height='15'><b>Keys</b></td><td width='125' height='15'><b>Main</b></td></tr>";
document.write(infoTable);
cName = xmlDoc.getElementsByTagName("member")[i].childNodes[0].firstChild.nodeValue;
}
Tanker
01-07-2003, 06:55 PM
The reason I have to use XML for this:
The site its going to reside on doesn't support any server side languages. And manually keeping the member list up to date is a nightmare in itself :(
So eventually the htm file will be on another server and read my CFM generated XML file from my server.
Thanks, ill try making the write statements smaller, see if that helps.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.