ukcoalition.org
*Home>>>AIDS Test

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


Hi I have an xml datafeed from http://xmlfeed.laterooms.com/index.aspx?...

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

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

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/r242_h... 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...please can someone help me as it is driving me nuts!!
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...
document.write("</td><td>");
document.write(x[i].getElementsByTagName...
document.write("</td></tr>");
}
document.write("</table>");
</script>

Can you please stop listing paysites..I just need a couple of lines tweaking..but I can't work out which ones :-(

Hi OKBusinessGroup,

I use the createDOM() method to transform the responseText into a DOM document:

<script type="text/javascript">
var xmlDoc;
function createDOM(sXml){
var browser = navigator.appName;
var oXmlDom = null;
if(browser == "Microsoft Internet Explorer") {
oXmlDom=new ActiveXObject("Microsoft.XMLDOM");
oXmlDom.async="false";
oXmlDom.loadXML(sXml);
}
else {
var oParser = new DOMParser();
oXmlDom = oParser.parseFromString(sXml, "text/xml");
}
return oXmlDom;
}
function loadXMLDoc(url){
xmlDoc=null;
if(window.XMLHttpRequest){
xmlDoc=new XMLHttpRequest();
}
else if (window.ActiveXObject){
xmlDoc=new ActiveXObject("Microsoft.XMLHTTP");
}
if(xmlDoc!=null){
xmlDoc.onreadystatechange=stateChange;
xmlDoc.open("GET",url,false);
xmlDoc.send(null);
}
}
function stateChange(){
if(xmlDoc.readyState==4){
if(xmlDoc.status==200){
var xmlres = createDOM(xmlDoc.responseText);
var country = xmlres.getElementsByTagName('country')[0...
var regions = country.getElementsByTagName('region');
document.write("<table border='1'>");
for(var i = 0; i < regions.length; i++){
document.write("<tr><td>");
var tag1 = regions[i].getElementsByTagName("tag1");
document.write(tag1[0].childNodes[0].n...
document.write("</td><td>");
var tag2 = regions[i].getElementsByTagName("tag2");
document.write(tag2[0].childNodes[0].n...
document.write("</td></tr>");
}
document.write("</table>");
}
}
}
window.onload = function(){
loadXMLDoc('england.xml');
}
</script>

england.xml
<?xml version="1.0" encoding="windows-1250"?>
<country>

<region>
<tag1>yep</tag1>
<tag2>nope</tag2>
</region>

<region>
<tag1>hey</tag1>
<tag2>wow</tag2>
</region>

<region>
<tag1>yes</tag1>
<tag2>ok</tag2>
</region>

</country>

Best regards,

subexpression

EDIT:
One line got truncated:
var country = xmlres. getElementsByTagName ('country')[0];

Tags
  AIDS Cure   AIDS Treatment   AIDS Symptom   AIDS Vaccine   AIDS Virus   AIDS Prevention   AIDS Test   HIV Information   HIV Drug   HIV Rash   HIV Window Period   Anti HIV
Related information
  • Smoking weed while pregnant?

    Yes they will test when the baby is born, especially now that they know she has smoked weed during pregnancy. I work in social services and have seen this happen a million times. If the baby is pos...

  • Got accepted into a prestigious boarding school & dad says i cant go?

    Try and talk, convince him argue do anything and everything you can. So what if he is hard to argue with? Your alternative is do nothing and let this oppurtunity slip by. if you try to reason with ...

  • How do you deal with a situation where you're wrongfully accused of something, but not allowed to explain?

    Everyone has a right to explain the truth or their side of the story. Their rights shouldn't be denied, otherwise it is a violation of human rights. The ones that treat you like trash because ...

  • Could I Get Into Carnegie Mellon?

    To be frank, your overall GPA (weighted is irrelevant to the admissions panel) is on the low side and the extracurriculars are quite weak when compared to the "normal" CMU student. You mu...

  • Is Obama finally getting the big picture?

    He may well be. I had the chance to see him in Green Bay WI and he actually mentioned something about getting rid of useless teachers really he did I was amazed thinking him to be in the teachers u...

  • College and Microbiology/Biology? Long question?

    Actually, alot of this is moot at this point, because to be a virologist you will pretty much need a PhD--so that is so far down the road that salary is unknown. Your bachelors can really be from ...

  • I need help with a dream?

    First of all, the saying about dreaming of a birth means death is coming is the same as seeing a black cat, bad luck will come upon you. That is supersititon. There is no basis to support it. ...

  • Can someone read&review my paper on rats for school exams?

    Good info for the most part, there are a few errors. Paragraph 3, line 4, laboratory, not laoratory. Paragraph 7-8, line 4, myco flare ups can lead to pneumonia as a secondary infection, but this...

  •  

    Categories--Copyright/IP Policy--Contact Webmaster