NOTE!!!!
I have found that FF and Chrome process kml in the DOM one way, while
IE processes it another way. Therefore, I had to re-write the
getExtendedData() function for cross-browser compatibility. It is
documented inside the code below.
Here it is. As usual, if you need it, you'll have to copy and format
the indents on your own. This editor makes indenting very difficult.
// Note: The above works that way for FF and Chrome, but not IE.
// In IE, there will be either 0 or 1 children.
browser=navigator.appName;
if (browser.search(/Internet Explorer/i)==(-1))
{
if (data[i].childNodes.length==3)
{
// Then, childNodes[1] is the value node.
retValue=data[i].childNodes[1].textContent;
}
}
else
{
// IE.
if (data[i].childNodes.length==1)
{
// Then, childNodes[0] is the value node.
// IE does not like textContent. It likes childNodes
[0].nodeValue.
retValue=data[i].childNodes[0].childNodes[0].nodeValue;
}
}
// No need to continue going through rest of <Data> tags.
// The match has been found and processed.
break;
}
else
{
// I like setting the following default return because the only
way this occurs is if programmer
// makes an error and references a <Data (name)> which does not
exist.
// Returning an empty string is a bit cryptic. Likely, when the
program
// does not perform as expected, programmer will be wondering
what, among many
// possibilities, is wrong. This return will make it obvious
when programmer
// tests the return value in the calling procedure. An alert can
cause
// inconvenience in cases where this function is called within a
loop.
retValue='ExtendedData variable "'+varName+'" not found.';
}
}
return retValue;
}