解析xml [英] Parsing xml

查看:78
本文介绍了解析xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个xml文件:

    Response: <ns3:ExecuteResponse xmlns:ns3="http://www.opengis.net/wps/1.0.0" xmlns:ns1="net/ows/1.1" xmlns:ns2="http://www.w3.org/1999/xlink" statusLocation="xxxxf62" serviceInstance="http:/http-post" version="1.0.0" service="xxx">
<ns3:Process ns3:processVersion="0.2">
<ns1:Identifier>OM_B</ns1:Identifier>
<ns1:Title xml:lang="en-US">Bioclim</ns1:Title>
<ns1:Abstract xml:lang="en-US">yyyyyyyyyyyyyyyy</ns1:Abstract>
</ns3:Process>
<ns3:Status creationTime="2010-07-06T17:38:13.355+02:00">
<ns3:ProcessAccepted>ProcessConfiguration has been accepted.</ns3:ProcessAccepted>
</ns3:Status>
<ns3:ProcessOutputs />
</ns3:ExecuteResponse>

如何在ExecuteResponse节点中提取statusLocation属性?

How I can extract statusLocation attribute in ExecuteResponse node?

非常感谢。

推荐答案

您是否通过 XMLHttpRequest收到了此XML文件?如果是这样,您可以使用其 responseXML 属性。

Have you received this XML file via an XMLHttpRequest? If so, you can use its responseXML property.

alert(xhr.responseXML.documentElement.getAttribute("statusLocation"));

或者使用jQuery:

Or with jQuery:

$.ajax({
    type: "GET",
    url: "yourfile.xml",
    dataType: "xml",
    success: function(xml) {
        alert(xml.documentElement.getAttribute("statusLocation"));
    }
});

这篇关于解析xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆