J
JJA
Here is my entire XML file - simplified to one node for testing:
<root>
<FlasConustbl>
<ID>42101</ID>
<AWARD>P015B030001</AWARD>
<INSTITUTION_KEY>300</INSTITUTION_KEY>
<INSTITUTION>Boston University</INSTITUTION>
<WORLDAREA>Africa</WORLDAREA>
<STREET>270 Bay State Road</STREET>
<CITY>Boston</CITY>
<STATE>Massachusetts</STATE>
<ZIP>02215</ZIP>
<COUNT>1</COUNT>
<PO_NAME>BOSTON</PO_NAME>
<NAMETYPE>POST OFFICE</NAMETYPE>
<ZIP_TYPE>NON-UNIQUE ZIP</ZIP_TYPE>
<Longitude>-71.101984</Longitude>
<Latitude>42.346498</Latitude>
<STATE_FIPS>25</STATE_FIPS>
<STATE_ABBR>MA</STATE_ABBR>
</FlasConustbl>
</root>
Here is my code:
var request = GXmlHttp.create();
request.open("GET", "SimpleOneNode.xml", true);
request.onreadystatechange = function() {
if (request.readyState == 4) {
var xmlDoc = request.responseXML;
// obtain the array of markers and loop through it
var markers =
xmlDoc.documentElement.getElementsByTagName("FlasConustbl");
for (var i = 0; i < markers.length; i++) {
// obtain the attributes of each marker
var lat =
parseFloat(GXml.value(markers.getElementsByTagName("Latitude")));
var lng =
parseFloat(GXml.value(markers.getElementsByTagName("Longitude")));
var point = new GLatLng(lat,lng);
}
}
}
request.send(null);
The statement:
var markers =
xmlDoc.documentElement.getElementsByTagName("FlasConustbl")
....seems to create a valid array but then subsequent attempts to
retrieve elements by tagname return ""
Can you see what I am doing wrong?
<root>
<FlasConustbl>
<ID>42101</ID>
<AWARD>P015B030001</AWARD>
<INSTITUTION_KEY>300</INSTITUTION_KEY>
<INSTITUTION>Boston University</INSTITUTION>
<WORLDAREA>Africa</WORLDAREA>
<STREET>270 Bay State Road</STREET>
<CITY>Boston</CITY>
<STATE>Massachusetts</STATE>
<ZIP>02215</ZIP>
<COUNT>1</COUNT>
<PO_NAME>BOSTON</PO_NAME>
<NAMETYPE>POST OFFICE</NAMETYPE>
<ZIP_TYPE>NON-UNIQUE ZIP</ZIP_TYPE>
<Longitude>-71.101984</Longitude>
<Latitude>42.346498</Latitude>
<STATE_FIPS>25</STATE_FIPS>
<STATE_ABBR>MA</STATE_ABBR>
</FlasConustbl>
</root>
Here is my code:
var request = GXmlHttp.create();
request.open("GET", "SimpleOneNode.xml", true);
request.onreadystatechange = function() {
if (request.readyState == 4) {
var xmlDoc = request.responseXML;
// obtain the array of markers and loop through it
var markers =
xmlDoc.documentElement.getElementsByTagName("FlasConustbl");
for (var i = 0; i < markers.length; i++) {
// obtain the attributes of each marker
var lat =
parseFloat(GXml.value(markers.getElementsByTagName("Latitude")));
var lng =
parseFloat(GXml.value(markers.getElementsByTagName("Longitude")));
var point = new GLatLng(lat,lng);
}
}
}
request.send(null);
The statement:
var markers =
xmlDoc.documentElement.getElementsByTagName("FlasConustbl")
....seems to create a valid array but then subsequent attempts to
retrieve elements by tagname return ""
Can you see what I am doing wrong?