asp读取XML数据

prodital 2018-03-16 07:10:04
<head>
<ReferenceID>[string]</ReferenceID>
<RspCode>[string]</RspCode>
<RspMsg><![CDATA[]]></RspMsg>
<ReqDate>[string]</ReqDate>
<RspDate>[string]</RspDate>
<Signature>[string]</Signature> //由 RetEncodeType 决定
</head>
<body>
<MerBillNo>[string]</MerBillNo>
<CurrencyType>[string]</CurrencyType >
<Amount>[string]</Amount>
<Date>[string]</Date>
<Status>[string]</Status>
<Msg><![CDATA[]]></Msg>
<Attach><![CDATA[]]></Attach>
<IpsBillNo>[string]</IpsBillNo>
<IpsTradeNo>[string]</IpsTradeNo>
<RetEncodeType>[string]</RetEncodeType>
<BankBillNo>[string]</BankBillNo>
<ResultType>[string]</ResultType>
<IpsBillTime>[string]</IpsBillTime>
</body>
怎么读取<head>和<body></body>的值
...全文
543 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hookee 2018-03-19
  • 打赏
  • 举报
回复

Set oNode = oDoc.selectSingleNode("//head/ReferenceID")
If Not oNode Is Nothing Then
    Response.Write oNode.text
End If
Set oNode = oDoc.selectSingleNode("//body/MerBillNo")
If Not oNode Is Nothing Then
    Response.Write oNode.text
End If

prodital 2018-03-17
  • 打赏
  • 举报
回复
错误代码: msxml6.dll 错误 '80004005' Unexpected character in query string. -->\<--\head\ReferenceID /pay/return.asp,行 22
prodital 2018-03-17
  • 打赏
  • 举报
回复
引用 2 楼 hookee 的回复:

<%
Set oDoc = CreateObject("Msxml2.DOMDocument.6.0")
With oDoc
	.async = False
	.validateOnParse = False
	.preserveWhiteSpace = False
	.resolveExternals = False
	'.setProperty "NewParser", True
	.load sXMLFilePath
	'或 .loadXML sXMLText
	If .parseError.errorCode <> 0 Then
		sErrMsg = .parseError.errorCode & "|" & .parseError.srcText & "|" & .parseError.reason
		Set oDoc = Nothing
		Response.Write sErrMsg
		Response.End
	End If
End With
Set oNode = oDoc.selectSingleNode("\\head\ReferenceID")
If Not oNode Is Nothing Then
	Response.Write oNode.text
End If
Set oNode = oDoc.selectSingleNode("\\body\MerBillNo")
If Not oNode Is Nothing Then
	Response.Write oNode.text
End If

Set oNode = Nothing
Set oDoc = Nothing
%>
提示有问题哦 Unexpected character in query string. -->\<--\head\ReferenceID
hookee 2018-03-17
  • 打赏
  • 举报
回复

<%
Set oDoc = CreateObject("Msxml2.DOMDocument.6.0")
With oDoc
	.async = False
	.validateOnParse = False
	.preserveWhiteSpace = False
	.resolveExternals = False
	'.setProperty "NewParser", True
	.load sXMLFilePath
	'或 .loadXML sXMLText
	If .parseError.errorCode <> 0 Then
		sErrMsg = .parseError.errorCode & "|" & .parseError.srcText & "|" & .parseError.reason
		Set oDoc = Nothing
		Response.Write sErrMsg
		Response.End
	End If
End With
Set oNode = oDoc.selectSingleNode("\\head\ReferenceID")
If Not oNode Is Nothing Then
	Response.Write oNode.text
End If
Set oNode = oDoc.selectSingleNode("\\body\MerBillNo")
If Not oNode Is Nothing Then
	Response.Write oNode.text
End If

Set oNode = Nothing
Set oDoc = Nothing
%>
prodital 2018-03-16
  • 打赏
  • 举报
回复
就是要读取各个节点中的值,如 RspMsg、MerBillNo的值,要用ASP语言来写

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧