码迷,mamicode.com
首页 > Web开发 > 详细

WebLoad 解析服务器返回的XML格式内容

时间:2014-12-26 12:27:35      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:

Parsing the XML Response

get the root node:  var rootNode = document.wlXmls[0].XMLDocument.documentElement

 

get the root node‘s name : rootNode.nodeName

 

get the root node‘s first child:  var fisrtChild = rootNode.childNodes.item(0)
 
Note: the text of a node is also a node. 
 
Case: get the performanceId:0P0000007E of below XML Dom
<ArrayOfPerformanceIdObjectBase>
    <PerformanceIdObjectBase>
        <PerformanceId>0P0000007E</PerformanceId>
    </PerformanceIdObjectBase>
    <PerformanceIdObjectBase>
        <PerformanceId>0P000000Q0</PerformanceId>
    </PerformanceIdObjectBase>
</ArrayOfPerformanceIdObjectBase>
 
function InitAgenda(){
    wlGlobals.ParseXML = true
}
wlHttp.GetXML
= true; var XMLresponse = document.wlXmls[0]; var XMLDoc = XMLresponse.XMLDocument; var element = XMLDoc.documentElement; //InfoMessage("The name of the root node is: " + element.nodeName); var fisrtChildNode = element.childNodes.item(0); // get the <PerformanceId> node var perfNode = fisrtChildNode.childNodes.item(0); // get the first <PerformanceIdObjectBase> node var perfId = perfNode.childNotes.item(0).nodeValue; // get the text node and get its value:0P0000007E

 

 

 

WebLoad 解析服务器返回的XML格式内容

标签:

原文地址:http://www.cnblogs.com/tomweng/p/4186228.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!