<!--解析XML字符串,跨浏览器实例-->
<html>
<head>
<script type = "text/javascript">
function parseXML()
{
text = "<note>";
text = "<to>George</to>";
text = "<from>Jhon</from>";
text = text + "<heading>Reminder</heading>";
text = text + "<body>Don‘t forget</body>";
text = text + "</note>";
try
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.loadXML(text);
}
catch(e)
{
try
{
parser = new DOMParser();
xmlDoc = parser.parseFromString(text, "text/html");
}
catch(e)
{
alter(e.message);
return;
}