Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    Northern California
    Posts
    50
    Thanks
    2
    Thanked 0 Times in 0 Posts

    New to XML, Need help speeding this up.

    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.

  • #2
    eak
    eak is offline
    Regular Coder eak's Avatar
    Join Date
    Jun 2002
    Location
    Nashville, TN
    Posts
    354
    Thanks
    0
    Thanked 26 Times in 26 Posts
    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'>&nbsp;</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'>&nbsp;</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;
    }
    eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."

  • #3
    New Coder
    Join Date
    Jun 2002
    Location
    Northern California
    Posts
    50
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •