| 发表于:2007-10-12 13:51:295楼 得分:0 |
public sub loaddocument(sfile as string) dim xdoc as msxml2.domdocument set xdoc = new msxml2.domdocument xdoc.validateonparse = false '这行用true也试试 if xdoc.load(sfile) then ' the document loaded successfully. ' now do something intersting. else dim strerrtext as string dim xpe as msxml2.ixmldomparseerror ' ?得parseerror?象 set xpe = xdoc.parseerror with xpe strerrtext = " xml document 不能load " & _ "原因是." & vbcrlf & _ "error: " & .errorcode & ": " & xpe.reason & vbcrlf & _ "line #: " & .line & vbcrlf & _ "line position: " & .linepos & vbcrlf & _ "position in file: " & .filepos & vbcrlf & _ "source text: " & .srctext & vbcrlf & _ "document url: " & .url end with msgbox strerrtext, vbexclamation set xpe = nothing end if end sub | | |
|