I've been racking my head and searching the net (and these forums) to try and get around this problem. I have radio stations stored in an xml file (each state has their own xml file). I'm able to display each state's stations just fine on their own page, but the problem I'm running into comes when I want to display stations in a timezone page. Some states are in two different timezones and therefore have stations in two different timezones. I've posted basically the same question in the javascript forum to see if my javascripts need help, because one script will work in Firefox and not IE and another script will work in IE and not Firefox.
My xml question is this: should I list the timezone for each station as an attribute of the station tag or as its own separate element?
Should it be this:
Expand|Select|Wrap|Line Numbers
- <station timezone="CT">
Expand|Select|Wrap|Line Numbers
- <station>
- <timezone>CT</timezone>
- </station>
Expand|Select|Wrap|Line Numbers
- <stations>
- <station timezone="ET" ET="">
- <city>Chattanooga</city>
- <freq>99.9 FM</freq>
- </station>
- <station timezone="ET" ET="">
- <city>Knoxville</city>
- <freq>107.9 FM</freq>
- </station>
- <station timezone="CT" CT="">
- <city>Memphis</city>
- <freq>93.1 FM</freq>
- </station>
- <station timezone="CT" CT="">
- <city>Nashville</city>
- <freq>95.7 FM</freq>
- </station>
- </stations>
This works in FF but not IE:
Expand|Select|Wrap|Line Numbers
- <script type="text/javascript">
- xmlDoc=loadXMLDoc("stations.xml");
- x=xmlDoc.getElementsByTagName("city");
- for (i=0;i<x.length;i++)
- {
- if (x[i].parentNode.hasAttribute("CT"))
- {
- document.write(x[i].childNodes[0].nodeValue)
- document.write("<br />")
- }
- }
- </script>
Expand|Select|Wrap|Line Numbers
- <script type="text/javascript">
- xmlDoc=loadXMLDoc("stations.xml");
- xmlDoc.setProperty("SelectionLanguage", "XPath");
- x=xmlDoc.selectNodes("//station[@timezone='CT']/city");
- for (i=0;i<x.length;i++)
- {
- document.write(x[i].childNodes[0].nodeValue)
- document.write("<br />")
- }
- </script>
Anyway, if you have any idea what's going here and how to do this...THANK YOU!