日期:2014-05-16 浏览次数:21141 次
s = "<xml name=""sendOnce"" result=""1""><Item cid=""80000""/></xml>"
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
End If
End With
Response.Write oDoc.documentElement.getAttribute("result")
Set oDoc = Nothing
'利用asp创建objhttp对象发送请求,一种类似ajax的方式
objHttp.open "POST", "http://XXXXXX.COM", false
objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objHttp.Send str
'200的意思就不说了。
If objHttp.status=200 Then
Dim PageResponseTime
Set objXML = CreateObject("MSXML2.DOMDocument")
objXML.async=False
objXML.Load(objHttp.responseXML)
'这里是返回的是错误信息
If objXML.parseError.errorCode <> 0 Then
'错误
Response.Write objXML.parseError.errorCode &vbcrlf
Response.Write objXML.parseError.filepos &vbcrlf
Response.Write "Line: "&objXML.parseError.Line&": "&objXML.parseError.linepos &vbcrlf
Response.Write "Reason: "&objXML.parseError.reason&vbcrlf
Response.Write "Error Data: "&objXML.parseError.srcText
End If
'下面开始读取节点的名字了,有个节点是<flightItems></flightItems>
Set objFlight=objXML.getElementsByTagName("flightItems")