3001,参数错误,这是什么错误啊?
我现在用DOM来读写XML文档,其实不是自己写的,网上搜到的一个ASP版本的,可以运行成功,我改到了VB里面,但是出现了问题。
在.Write objNodeList(i).nextSibling.nodeTypedValue这一句上,提示错误“3001,参数类型不正确,或不在可接受的范围内,或与其他参数冲突”
代码如下:
Set objXmlFile = CreateObject("Microsoft.XMLDOM")
objXmlFile.Load ("update.xml")
If objXmlFile.readyState = 4 Then
If objXmlFile.parseError.errorCode = 0 Then
Set objNodeList = objXmlFile.documentElement.selectNodes("//folder/path")
Set objFSO = CreateObject("Scripting.FileSystemObject")
j = objNodeList.length - 1
For i = 0 To j
If objFSO.FolderExists(strLocalPath & objNodeList(i).Text) = False Then
objFSO.CreateFolder (strLocalPath & objNodeList(i).Text)
End If
Next
Set objFSO = Nothing
Set objNodeList = Nothing
Set objNodeList = objXmlFile.documentElement.selectNodes("//file/path")
j = objNodeList.length - 1
For i = 0 To j
Set objStream = CreateObject("ADODB.Stream")
With objStream
.Type = 1
.Open
.Write objNodeList(i).nextSibling.nodeTypedValue
.SaveToFile strLocalPath & objNodeList(i).Text, 2
.Close
End With
Set objStream = Nothing
Next
Set objNodeList = Nothing
End If
End If
Set objXmlFile = Nothing
另外,我尝试把出错的.Write objNodeList(i).nextSibling.nodeTypedValue这一句删除掉,程序就可以通过,生成文件,只不过文件里面没有实质性的内容,就差这一句了,各位帮帮忙了,先谢过~!