Hi All,
I'm having a problem while parsing xml file full of markers into my
ASP.NET Application.
My code is working very well in chrome but its now working in Firefox
and IE (all vesrsion).
My Main Problem is in
xmlDoc.documentElement.getElementsByTagName("marker");
This is returning 18 value exact that i need in chrome but in Firefox
and it is returning zero value and in IE m getting null or object not
defined error.
Following is my code:
=================================================
var request = GXmlHttp.create();
var marker_str = "SearchResponse.aspx";
request.open("GET", marker_str, true);
request.onreadystatechange = function () {
//alert("GXML1");
//alert(request.readyState);
//alert(request.status);
if (request.overrideMimeType) {
request.overrideMimeType('text/xml');
}
if (request.readyState == 4) {
var xmlDoc = request.responseXML;
var textDoc = request.responseText;
// get all nodes and put them in the array
'locations'
xmlDoc = GXml.parse(request.responseText);
//alert(request.responseXML);
alert(request.responseText);
var markers =
xmlDoc.documentElement.getElementsByTagName("marker");
//var markers =
xmlDoc.getElementsByTagName("marker");
alert(xmlDoc.getElementsByTagName("marker")
[0].getAttribute('Postcode').toLowerCase());
alert(markers.length);
if (markers.length == 0) {
alert('No results found. Please try
widening your search area.');
return;
}
alert("inside3");
for (var i = 0; i < markers.length; i++) {
var postcode =
markers[i].getAttribute('Postcode').toLowerCase();
marker(postcode);
alert(postcode);
}
}
}
request.send(null);
=====================================================
XML File:
<?xml version="1.0" encoding="iso-8859-1"?>
<markers>
<marker Postcode="AB25 2AY" />
<marker Postcode="AB25 2AY" />
<marker Postcode="E17 5DN" />
<marker Postcode="E17 5DN" />
<marker Postcode="EH4 2XU" />
<marker Postcode="EH8 9AG" />
<marker Postcode="HA0 2LT" />
<marker Postcode="HA0 2LT" />
<marker Postcode="HA0 2LT" />
<marker Postcode="HA0 2LT" />
<marker Postcode="HA0 2LT" />
<marker Postcode="HA0 2LT" />
<marker Postcode="HA0 2LT" />
<marker Postcode="HA0 2LT" />
<marker Postcode="SE1 9NH" />
<marker Postcode="SE1 9NH" />
<marker Postcode="SE1 9NH" />
<marker Postcode="SE1 9NH" />
</markers>
Any help anyone can offer would be greatly appreciated.
Thanks,
Amit
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.