标题:ASP中Vbscript读取XML的问题
取消只看楼主
yingxiang
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2012-9-7
结帖率:0
已结贴  问题点数:20 回复次数:0 
ASP中Vbscript读取XML的问题
问题如题:

以下是读取XML代码,输出的总是“装载XML文件错误”请高手帮我看一下究竟是代码有问题还是XML有问题(XML是写的)
【后附XML内容】
<% '读取XML内容
Function ReadXML(XMLName,TagName)
Set objXML2 = Server.CreateObject("Msxml2.DOMDocument")
objXML2.async = False
loadResult = objXML2.load(Server.MapPath(XMLName))

if not loadResult then
    Response.write "装载XML文件错误"
    Response.end
end If
Set objNodes = objXML2.getElementsByTagName(TagName)
For i = 0 to objNodes.length - 1
    For k=0 To objNodes(i).ChildNodes.length - 1
        Response.write Trim(objNodes(i).ChildNodes(k).Text)&"<br>"
    Next
Next

set objNodes = Nothing
Set objXML = Nothing
End Function
%>

XML内容如下:
<?xml version="1.0" encoding=" GB2312" ?>
<recr>

<rto>
<strto>XXX; </strto>
<strcc></strcc>
<strbcc></strbcc>
<strsubject>YY!</strsubject>
<strcontent>24</strcontent>
</rto>

<rto>
<strto>xx; </strto>
<strcc></strcc>
<strbcc></strbcc>
<strsubject>xxy!</strsubject>
<strcontent>23</strcontent>
</rto>

<rto>
<strto>xx; </strto>
<strcc></strcc>
<strbcc></strbcc>
<strsubject>ctx!</strsubject>
<strcontent>22</strcontent>
</rto>

<rto>
<strto> </strto>
<strcc>strcccx;</strcc>
<strbcc></strbcc>
<strsubject>xxer!</strsubject>
<strcontent>21</strcontent>
</rto>

<rto>
<strto> </strto>
<strcc></strcc>
<strbcc>ww;</strbcc>
<strsubject>xxcfd!</strsubject>
<strcontent>20</strcontent>
</rto>

<rto>
<strto></strto>
<strcc></strcc>
<strbcc>addde;</strbcc>
<strsubject>oemfd!</strsubject>
<strcontent>19</strcontent>
</rto>

</recr>
搜索更多相关主题的帖子: False 
2012-09-07 12:02



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-380908-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.091950 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved