www.webdeveloper.com
Results 1 to 2 of 2

Thread: XML Datafeed Help - Almost there...just need a hand!?

Hybrid View

  1. #1
    Join Date
    Jun 2009
    Posts
    1

    Angry XML Datafeed Help - Almost there...just need a hand!?

    Hi I have an xml datafeed from http://xmlfeed.laterooms.com/index.a...&rtype=1&rid=1

    I have made a local xml copy http://www.cytravel.co.uk/test/html/england.xml

    And currently the page displays ok here http://www.cytravel.co.uk/test/html/...n_england.html

    What I actually want to do is make all the "region_descriptions" linkable using the url next to them so "Central and South England" should jst be clickable through to http://www.laterooms.com/en/p4066/r2...h-england.aspx and the same for each region (preferably with an alt tag that states "click here for cheap hotels in (region_description)

    The code I am currently using is below will it be possible to fix it fairly easily?
    TIA

    <script type="text/javascript">
    var xmlDoc;
    if (window.XMLHttpRequest)
    {
    xmlDoc=new window.XMLHttpRequest();
    xmlDoc.open("GET","england.xml",false);
    xmlDoc.send("");
    xmlDoc=xmlDoc.responseXML;
    }
    // IE 5 and IE 6
    else if (ActiveXObject("Microsoft.XMLDOM"))
    {
    xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async=false;
    xmlDoc.load("england.xml");
    }

    document.write("<table border='1'>");
    var x=xmlDoc.getElementsByTagName("region");
    for (i=0;i<x.length;i++)
    {
    document.write("<tr><td>");
    document.write(x[i].getElementsByTagName("region_description")[0].childNodes[0].nodeValue);
    document.write("</td><td>");
    document.write(x[i].getElementsByTagName("region_url")[0].childNodes[0].nodeValue);
    document.write("</td></tr>");
    }
    document.write("</table>");
    </script>

  2. #2
    Join Date
    Jun 2009
    Posts
    27
    You could easily do this with a stylesheet (XSL) and skip all the scripting. If you want to explore that, let me know.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles