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>