<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<script language="javascript">
var xml="<?xml version='1.0' encoding='UTF-8'?><feedback><row><col>1717110100000202</col><col>菏东路万福警务工作站</col></row><row><col>2717110100000202</col><col>菏东路万福警务工作站</col></row><row><col>3717110100000202</col><col>菏东路万福警务工作站</col></row></feedback>";
//去掉头
xml=xml.replace("<?xml version='1.0' encoding='UTF-8'?>","");
//调用函数
var xmlObj=toXML(xml);
var row=xmlObj.firstChild.childNodes;
for(var i=0;i< row.length;i++){
//alert(row[i].childNodes[0].childNodes[0].nodeValue);//数值
alert(row[i].childNodes[1].childNodes[0].nodeValue); //文字
}
function toXML(strxml){
try{
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
//var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
xmlDoc.loadXML(strxml);
}
catch(e){
var oParser=new DOMParser();
xmlDoc=oParser.parseFromString(strxml,"text/xml");
}
return xmlDoc;
}
</script>
</body>
</html>