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 first <PerformanceIdObjectBase> node var perfNode = fisrtChildNode.childNodes.item(0); // get the <PerformanceId> node var perfId = perfNode.childNotes.item(0).nodeValue; // get the text node and get its value:0P0000007E

===========================================================

<?xml version="1.0"?>
<res>
  <status code="0" status="0">
    <message>a_172.26.41.111:50006_1dbe4f42-acb3-ae47-9008-936faf1b0679</message>
  </status>
</res>

var contents = document.wlSource;

var xmlObject = new XMLParserObject()
var doc = xmlObject.parse(contents) InfoMessage(doc.getElementsByTagName("res").item(0).getChildNodes()[0].getAttribute("status")) var status = doc.getElementsByTagName("status").item(0).getAttribute("status")
var code = doc.getElementsByTagName("status").item(0).getAttribute("code")

以上都是取 status 这个属性

WebLoad 解析服务器返回的XML格式内容的更多相关文章

  1. WebLoad 解析服务器返回的JSON格式内容

    服务器返回Json格式的响应内容经常是以 String (txt) 形式返回给客户端.客户端需要把 文本形式的内容还原为Json格式以进一步做处理(如,取得返回内容的一个值作为下个请求的一个输入).这 ...

  2. JS读取服务器返回的XMl格式字符串

    function PostSMS(phoneNumber, sessionID, requestUrl, successAction) { $.ajax( { type: 'POST', url: r ...

  3. javascript 解析ajax返回的xml和json格式的数据

    写个例子,以备后用 一.JavaScript 解析返回的xml格式的数据: 1.javascript版本的ajax发送请求 (1).创建XMLHttpRequest对象,这个对象就是ajax请求的核心 ...

  4. javascript解析从服务器返回的json格式数据

    在javascript中我们可以将服务器返回的json格式数据转换成json格式进行使用,如下: 1.服务器返回的json格式数据: 通过response.responseText获得: " ...

  5. WebService如何封装XML请求 以及解析接口返回的XML

    原 WebService如何封装XML请求 以及解析接口返回的XML 置顶 2019年08月16日 15:00:47 童子泛舟 阅读数 28 标签: XML解析WebService第三方API 更多 ...

  6. Spring MVC同一方法返回JSON/XML格式

    最近一道面试题,要求同一API接口支持不同格式返回值.一开始是设想通过过滤器(Filter)设置返回值,但是并不可行,因为方法返回值一般都是类型需要做转换,而过滤器则是前置的.另一方面可以通过拦截器的 ...

  7. Java读取数据库中的xml格式内容,解析后修改属性节点内容并写回数据库

    直接附代码: 1.测试用的xml内容 <mxGraphModel> <root> <mxCell id="-1" /> <mxCell i ...

  8. WebService传递XML数据 C#DataSet操作XML 解析WebService返回的XML数据

    Webservice传递的数据只能是序列化的数据,典型的就是xml数据.   /// <summary>         /// 通过用户名和密码 返回下行数据         /// & ...

  9. C# 解析带前缀的Xml节点内容

    一般的xml文件相信大家都会解析了,但是遇到有命名空间的带前缀的xml,对于新手可能会有点问题.我这里在论坛解答的时候就遇到过一题,见怎么获取XML节点里面的内容,在线求教.这里给大家演示一下. 他的 ...

随机推荐

  1. 数学/找规律/暴力 Codeforces Round #306 (Div. 2) C. Divisibility by Eight

    题目传送门 /* 数学/暴力:只要一个数的最后三位能被8整除,那么它就是答案:用到sprintf把数字转移成字符读入 */ #include <cstdio> #include <a ...

  2. 贪心 Codeforces Round #109 (Div. 2) B. Combination

    题目传送门 /* 贪心:按照能选的个数和点数降序排序,当条件不符合就break,水题啊! */ #include <cstdio> #include <algorithm> # ...

  3. APP统计

    APP统计就是统计用户使用app的各项指标,比如说日活跃量,页面打开次数,新增用户数量,用户年龄分布,用户地区分布,用户性别分布以及用户使用时间段等等.将统计出来的用户信息进行比对分析,可以服务公司的 ...

  4. c#拖拽文件

    在“属性”窗口中,先设置MDI的父窗口的AllowDrop 属性更改为true;2.在父窗口的事件中添加下面两个事件 private void Form1_DragEnter(object sende ...

  5. P1478 陶陶摘苹果(升级版)

    题目描述 又是一年秋季时,陶陶家的苹果树结了n个果子.陶陶又跑去摘苹果,这次她有一个a公分的椅子.当他手够不着时,他会站到椅子上再试试. 这次与NOIp2005普及组第一题不同的是:陶陶之前搬凳子,力 ...

  6. 2.3点击菜单显示div再点击就隐藏

    事件:onclick 属性:display 利用if语句实现 <!DOCTYPE html><html><head><meta charset="u ...

  7. qt 5中文乱码

    头文件加上#prama execution_character_set("utf-8")

  8. Farseer.net轻量级ORM开源框架 V1.x 入门篇:存储过程数据操作

    导航 目   录:Farseer.net轻量级ORM开源框架 目录 上一篇:Farseer.net轻量级ORM开源框架 V1.x 入门篇:存储过程实体类映射 下一篇:Farseer.net轻量级ORM ...

  9. VUE scoped css 局部css内嵌样式方法 >>>

    <style scoped> .ivu-carousel >>> button { background-color: buttonface;} .demo-carous ...

  10. E. Wrong Answer

    E. Wrong Answer time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...