I am trying to learn the v3 API and was looking at the College Finder
example, but it does not work in IE 8. When I try to open the
examples in IE 8 I get the error "'DOMParser' is undefined". Has
anyone else encounted this and is the a way to make it work in IE8?
Thansks,
Doug
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
It got me past the DOMParser error, but then had another error for
'getElementsByTagNameNS'. Gotta love IE I guess. I did some
searching and it was strange to read on the Microsoft site about all
the compatibility work they have done in IE..
I am thinking that I will just have to redo the code in a way that IE
likes. Are there any other examples to work from that do work in more
browsers?
Doug
The lack of utility classes in v3 has been reported in
http://code.google.com/p/gmaps-api-issues/issues/detail?id=1364
and the suggested solution is to use code from
http://gmaps-samples-v3.googlecode.com/svn/trunk/xmlparsing/downloadurl.html
http://gmaps-samples-v3.googlecode.com/svn/trunk/xmlparsing/util.js
so you need to include the "util.js" in the html
<script src="util.js" type="text/javascript"></script>
and comment out the DOMParser line in SearchService.js
// this.parser_ = new DOMParser();
and then use the xmlParse function to convert the KML string
// var kml = this.parser_.parseFromString(kmlString, 'text/xml');
var kml = xmlParse(kmlString);
Is there a way to return all of the Elements of a given tag like the
code below in IE? If not, is the best approach to loop through the
XML and then build a new object to return?
Thanks,
Doug
/**
* Return all tags of the give type in an XML DOM node.
* @private
*/
google.code.mapsearch.SearchService.prototype.getTags_ =
function(node, tag) {
return node.getElementsByTagNameNS('http://www.opengis.net/kml/2.2',
tag);
}
On Apr 13, 4:57 am, William <william.g...@gmail.com> wrote:
> v3 doesn't have the utility classes like GXml, so the authors of the
> College Finder have tried to code it themselves by using the DOMParser
> class, but this isn't available in Microsoft browsers.
>
> The lack of utility classes in v3 has been reported inhttp://code.google.com/p/gmaps-api-issues/issues/detail?id=1364
>
> and the suggested solution is to use code fromhttp://gmaps-samples-v3.googlecode.com/svn/trunk/xmlparsing/downloadu...http://gmaps-samples-v3.googlecode.com/svn/trunk/xmlparsing/util.js
it looks like this KML doesn't have namespace prefixes (the tags are
like "placemark", not "kml:placemark"), so you can use the function
getElementsByTagName. I think this will work in all browsers.
replace:
return node.getElementsByTagNameNS('http://www.opengis.net/kml/2.2',
tag);
with:
return node.getElementsByTagName(tag);
Doug