AJAX´¦ÀíXMLÎĵµÎÊÌâ
<XML>
<FLAG>1</FLAG>
<REASON></REASON>
<ADVERT><ADID>64</ADID><ADNAME>Ó¢»ÊÓéÀÖËÄ</ADNAME><ADCONTENT>ÄÚÈÝÒ»</ADCONTENT><ADTIME>50.0</ADTIME></ADVERT>
<ADVERT><ADID>66</ADID><ADNAME>Ó¢»ÊÓéÀÖÈý</ADNAME><ADCONTENT>ÄÚÈݶþ</ADCONTENT><ADTIME>51.0</ADTIME></ADVERT>
</XML>
ÎÒÌá½»ÓõÄÊÇPOST·½·¨£¬ÈçÉÏÊÇÌá½»ºó·þÎñÆ÷¶Ë·µ»ØµÄXMLÎı¾£¬ÎÒͨ¹ýÏÂÃæ·½·¨À´»ñÈ¡ÎĵµÄÚÈÝ£¬£º
//AJAXÏìÓ¦´¦Àíº¯Êý
function doProcess(){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
//´´½¨XML¶ÔÏó
var xmlDoc = xmlHttp.responseXML;//²âÊÔxmlDocÊǶÔÏó
//var testStr = xmlHttp.responseText;//testStr ¼´ÎªÉÏÃæ³öÏÖµÄXMLÎı¾
alert(xmlDoc.childNodes[0]);//µ«ÊÇËûµÄ×Ó½ÚµãΪnull
var flag = xmlDoc.getElementsByTagName("ADVERT");
alert(flag.length);//Êä³öΪ0£¬ÎªÊ²Ã´²»ÊÇ1
if(flag[0].firstChild.nodeValue==1){ //ÕâÀï¾ÍÖ±½Ó±¨´í˵¶ÔÏó²»´æÔÚÁË¡£¡£
var reason = xmlDoc.getElementsByTagName("REASON");
alert(reason[0].firstChild.nodeValue);
}
}
}
}
Çë°ïÎÒ·ÖÎöÏ£¬ÎªÊ²Ã´µÃµ½µÄ²»ÊÇÎÒÔ¤ÆÚµÄ½á¹û
ÿÌì»ØÌû¼´¿É»ñµÃ10·Ö¿ÉÓ÷Ö
ÊÔÊÔ
var xml = xmlDoc.documentElement;
alert(xml.childNodes.length);
2Â¥µÄ·½·¨ÎÒÓùýµÄ£¬Îª
Ïà¹ØÎÊ´ð£º
֮ǰÓöµ½Ò»¸öÎÊÌâ¡£
ÓÚÊÇ×öÁËÒÔÏÂʵÑ飺
Ò³Ãæ¼ÓÔØºó£¬Ìá½»Ò»¸öAjaxÇëÇó(ÔݳÆÎªajax1)£¬ÇëÇóµÄÏß³ÌÔÚ·þÎñÆ÷Éϱ»Ë¯Ãß10ÃëÖÓ¡£
µã»÷Ò³ÃæÉÏÒ»¸öbutton£¬´¥·¢ÁíÒ»¸öAjaxÇëÇó(ajax2)¡£
µ±Ã»ÓÐʹÓÃsession£¬ÔÚ·þÎñÆ÷δ´ ......
DataSetµ¼³öxml Åú´¦Àí(Ñ»·)µÃÔõô´¦Àí
XMLÎļþ
<A>
<B>
<C>
</C>
&nb ......
½ñÌìÓöµ½Ò»¸öÎÊÌ⣬°ÑxmlÖеÄÖµ×°µ½.txt¸ñʽµÄÎļþÖС£
ÎÒĿǰÏëµ½Á½ÖֱȽϱ¿µÄ·½·¨£º1.¿ÉÒÔͨ¹ýxmlspy±à¼¹¤¾ßʵÏÖ
2.ͨ¹ý°Ñxmlת³ÉJavabean£¬È»ºóתµ½excelÖУ¬ÔÙ´Óб£´æÖØÃüÃûΪ. ......
<?xml version="1.0"?>
<root>
<status>433</status>
<msg>Õâ¸öÊǺº×Ö</msg>
<serialno>123</serialno>
</root>
ÈçºÎÓÃASP¶ÁÈ¡ statusÖµ ......