日期:2014-05-16  浏览次数:20815 次

asp 读取远程xml内容
有远程 这个xml内容http://211.138.138.42:8080/httpapi.aspx?type=qamount&cpid=test&cppwd=1234567

用asp Microsoft.XMLDOM 读取response的这个-3值

<%@ CODEPAGE=65001 %> 
<% Response.CodePage=65001%> 
<% Response.Charset="UTF-8" %> 
<%
Set http=Server.CreateObject("Microsoft.XMLHTTP")
http.Open "GET","http://211.138.138.42:8080/httpapi.aspx?type=qamount&cpid=test&cppwd=1234567",False
http.send
Set xml=Server.CreateObject("Microsoft.XMLDOM")
xml.Async=False
xml.ValidateOnParse=False
xml.Load(http.ResponseXML)
If xml.ReadyState>2 Then
.....

%>
下面如何写?请指教
XML ASP XMLDOM XMLHTTP

------解决方案--------------------

<%
url = "http://211.138.138.42:8080/httpapi.aspx?type=qamount&cpid=test&cppwd=1234567"

Set oHttp = CreateObject("Msxml2.ServerXMLHTTP")
oHttp.Open "GET", url, False
oHttp.Send
xml = oHttp.responseText
Set oHttp = Nothing
Set oDoc =  CreateObject("Msxml2.DomDocument")
With oDoc
    .async              = False
    .validateOnParse    = False
    .preserveWhiteSpace = False
    .resolveExternals   = False
.loadXML xml
    If .parseError.errorCode <> 0 Then
        sErrMsg = .parseError.errorCode & "
------解决方案--------------------
" &_
                  .parseError.srcText & "
------解决方案--------------------
" & .parseError.reason
        Set oDoc = Nothing
        Response.Write sErrMsg
        Response.End
    End If
Set oNode = .selectSingleNode("//response")
If Not oNode Is Nothing Then
Response.Write oNode.text
End If
Set oNode = Nothing
End With
Set oDoc = Nothing

%>