锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
濡傛灉榪斿洖鐨勬槸鏍囧噯鐨刋ML(鏈?lt;?xml version="1.0" encoding="UTF-8"?>,騫朵笖ContentType = "text/xml")錛屽垯鐩存帴鎿嶄綔xmlhttp.responseXML搴旇鏄彲浠ョ殑,姣斿錛?br />var requestMsg=xmlhttp.responseXML;
alert(requestMsg.getElementsByTagName("book").length);
濡傛灉涓嶆槸鏍囧噯鐨刋ML.鍒欒繑鍥炵殑淇℃伅瀹為檯涓婃槸浠ユ枃鏈殑鏂瑰紡琛ㄧず鐨勶紝蹇呴』浠巟mlhttp.responseText涓彇寰楁暟鎹紝鏂瑰紡濡備笅錛?br />var requestMsg=getXMLDoc(originalRequest.responsetext);
alert(requestMsg.getElementsByTagName("book").length);
getXMLDoc鏂規硶濡備笅:
聽function getXMLDoc(xmlText){
聽聽if(window.ActiveXObject){
聽聽聽xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
聽聽聽xmlDoc.async=false;
聽聽聽xmlDoc.onreadystatechange = function()
聽聽聽{
聽聽聽聽//if(xmlDoc.readyState == 4) doAction();
聽聽聽}
聽聽聽xmlDoc.loadXML(xmlText);
聽聽}else if(document.implementation&&document.implementation.createDocument){
聽聽聽xmlDoc=document.implementation.createDocument('','',null);
聽聽聽//xmlDoc.onload=doAction();
聽聽聽xmlDoc.loadXML(xmlText);
聽聽}else return null;
聽聽return xmlDoc;
聽}