读取xml时出现错误 '800a01a8' 缺少对象 ,请帮忙解决
<!-- data.xml -->
<?xml version=1.0 encoding=gb2312?>
<root>
<document>
<Unit> aa </Unit>
<Project> bb </Project>
<HandleDept> bb </HandleDept>
<HandleDate> </HandleDate>
<RegDate> </RegDate>
<DealDate> </DealDate>
<DispatchOverTime> </DispatchOverTime>
<TakeTime> </TakeTime>
<TakeUser> </TakeUser>
<DealFlag> </DealFlag>
</document>
</root>
<!---------- aa.asp ------------->
<html>
<title> read xml </title>
<body>
<%
dim xml,root,nodeLis,node,i,nodecount
set xml = CreateObject( "Microsoft.XMLDOM ")
xml.async = false
xml.load(Server.MapPath( "data.xml "))
set root = xml.documentElement
set nodeLis = root.ChildNodes ' ' '行13
nodeCount = nodeLis.length
For i=1 to nodeCount
set node = nodeLis.nextNode()
'set cost = node.attributes.getNamedItem( "cost ")
%>
第 <%=i%> 条记录:
<table width= "250 " border= "1 " ID= "Table1 ">
<tr>
<td> 企业名称 </td>
<td> 申请事项 </td>
<td> 主办处室 </td>
</tr>
<tr>
<td>
<%=node.selectSingleNode( "Unit ").text%> </td>
<td>
<%=node.selectSingleNode( "Project ").text%> </td>
<td>
<%= node.selectSingleNode( "HandleDept ").text%> </td>
</tr>
</table>
<%
Next
%>
</body>
</html>
运行出现:
Microsoft VBScript 运行时错误 错误 '800a01a8 '
缺少对象
/testxml/aa.asp,行 13
[解决办法]
关注!学习.
[解决办法]
把XML的序言改为 <?xml version= "1.0 " encoding= "gb2312 "?> 即可,这是XML的常识哦。
[解决办法]
<?xml version= "1.0 " encoding= "gb2312 "?> xmlSPY测试了一下 这样就通过了