R
roel.wessels
Hello,
I'm working with Google Maps API and I have trouble understanding this
problem which is Javascript related. I've read some posts related to
this, but I can't seem to use it correctly.
Below is the is a sample of the XML file I use with GDownloadUrl() to
get the markers and relevant information for the tabbed infowindows.
Any help is highly appreciated!
<root>
<airport id="1925">
<name>AMSTERDAM SCHIPHOL</name>
<lat>52.308056</lat>
<lon>4.764167</lon>
<country>Netherlands</country>
<runways>
<runway ident="04">
<length>6608</length>
<surface>ASP</surface>
</runway>
<runway ident="06">
<length>11483</length>
<surface>ASP</surface>
</runway>
</runways>
</airport>
<airport id="1927">
<name>MAASTRICHT</name>
<lat>50.915833</lat>
<lon>5.776944</lon>
<country>Netherlands</country>
<runways>
<runway ident="03">
<length>9027</length>
<surface>ASP</surface>
</runway>
<runway ident="21">
<length>9027</length>
<surface>ASP</surface>
</runway>
</runways>
</airport>
To parse this data I use the following script:
GDownloadUrl("http://airportv2.ceeya.net/final/test_eh2.xml",
function(data) {
var xml = GXml.parse(data);
var markers =
xml.documentElement.getElementsByTagName("airport");
for (var i = 0; i < markers.length; i++) {
marker = markers;
airport_name = GXml.value(marker.getElementsByTagName("name")[0]);
airport_lat = parseFloat(GXml.value(marker.getElementsByTagName("lat")
[0]));
airport_lon = parseFloat(GXml.value(marker.getElementsByTagName("lon")
[0]));
var runway_html = airport_name;
var runway = marker.getElementsByTagName("runway");
var runway_html =
GXml.value(runway.getElementsByTagName("length")[0]);
}
The airport data elements are shown fine. The problem is getting to
display the runway data.
Are the runway elements not stored by
xml.documentElement.getElementsByTagName("airport")?
If not, what would be a possible solution.
Thanks in advance,
Roel Wessels
I'm working with Google Maps API and I have trouble understanding this
problem which is Javascript related. I've read some posts related to
this, but I can't seem to use it correctly.
Below is the is a sample of the XML file I use with GDownloadUrl() to
get the markers and relevant information for the tabbed infowindows.
Any help is highly appreciated!
<root>
<airport id="1925">
<name>AMSTERDAM SCHIPHOL</name>
<lat>52.308056</lat>
<lon>4.764167</lon>
<country>Netherlands</country>
<runways>
<runway ident="04">
<length>6608</length>
<surface>ASP</surface>
</runway>
<runway ident="06">
<length>11483</length>
<surface>ASP</surface>
</runway>
</runways>
</airport>
<airport id="1927">
<name>MAASTRICHT</name>
<lat>50.915833</lat>
<lon>5.776944</lon>
<country>Netherlands</country>
<runways>
<runway ident="03">
<length>9027</length>
<surface>ASP</surface>
</runway>
<runway ident="21">
<length>9027</length>
<surface>ASP</surface>
</runway>
</runways>
</airport>
To parse this data I use the following script:
GDownloadUrl("http://airportv2.ceeya.net/final/test_eh2.xml",
function(data) {
var xml = GXml.parse(data);
var markers =
xml.documentElement.getElementsByTagName("airport");
for (var i = 0; i < markers.length; i++) {
marker = markers;
airport_name = GXml.value(marker.getElementsByTagName("name")[0]);
airport_lat = parseFloat(GXml.value(marker.getElementsByTagName("lat")
[0]));
airport_lon = parseFloat(GXml.value(marker.getElementsByTagName("lon")
[0]));
var runway_html = airport_name;
var runway = marker.getElementsByTagName("runway");
var runway_html =
GXml.value(runway.getElementsByTagName("length")[0]);
}
The airport data elements are shown fine. The problem is getting to
display the runway data.
Are the runway elements not stored by
xml.documentElement.getElementsByTagName("airport")?
If not, what would be a possible solution.
Thanks in advance,
Roel Wessels