这个远程XML怎么解析到网页上? 用JS 或者ASP都可以
本帖最后由 phpkakaok 于 2013-07-02 15:28:53 编辑
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<Get_ProjectLicense_ListResponse xmlns="http://tempuri.org/">
<Get_ProjectLicense_ListResult>
{LicenseList:[{'lic_no':'aaa','proName':'bbb','lic_datetime':'2013-6-19'},{'lic_no':'aaa','proName':'bbb','lic_datetime':'2013-6-19'}]}
</Get_ProjectLicense_ListResult>
</Get_ProjectLicense_ListResponse>
</soap:Body></soap:Envelope>
<%
s = "<?xml version=""1.0"" encoding=""utf-8""?>" &_
"<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">" &_
"<soap:Body>" &_
"<Get_ProjectLicense_ListResponse xmlns=""http://tempuri.org/"">" &_
"<Get_ProjectLicense_ListResult>" &_
"{LicenseList:[{'lic_no':'aaa','proName':'bbb','lic_datetime':'2013-6-19'},{'lic_no':'aaa','proName':'bbb','lic_datetime':'2013-6-19'}]}" &_
"</Get_ProjectLicense_ListResult>" &_
"</Get_ProjectLicense_ListResponse>" &_
"</soap:Body></soap:Envelope>"
sText = ""
Set oDoc = CreateObject("Msxml2.DOMDocument")
With oDoc
.async = False
.validateOnParse = False
.preserveWhiteSpace = False
.resolveExternals = False
.loadXML s
If .parseError.errorCode <> 0 Then
sErrMsg = .parseError.errorCode & "
[解决办法]
" &_
.parseError.srcText & "
------解决方案--------------------
" & .parseError.reason
Response.Write sErrMsg
Response.End
End If
Set oNode = .selectSingleNode("//Get_ProjectLicense_ListResult")
If Not oNode Is Nothing Then sText = oNode.text
Set oNode = Nothing
End With
Set oDoc = Nothing
%>
<script>
var obj= <%=sText%>
window.onload=function(){
alert(obj.LicenseList.length);
}
</script>