XML DOM

L

Lars-Eric Gisslén

Fredrik,

Try this code (assumes you have added a reference to Microsoft XML):

Sub LoadXML()
Dim oDom As MSXML2.DOMDocument
Dim oError As MSXML2.IXMLDOMParseError

Set oDom = New DOMDocument

oDom.validateOnParse = False
oDom.async = False

oDom.Load "C:\Test.XML"

Set oError = oDom.parseError

If oError.errorCode <> 0 Then
MsgBox "Parse error!" & vbCr & _
"Error code: " & oError.errorCode & vbCr & _
"Reason: " & oError.reason & vbCr & _
"File: " & oError.url
Set oDom = Nothing
Exit Sub
End If

' Process the XML file

End Sub
 
F

FredrikT

Thanks, Lars-Eric!

-----Original Message-----
Fredrik,

Try this code (assumes you have added a reference to Microsoft XML):

Sub LoadXML()
Dim oDom As MSXML2.DOMDocument
Dim oError As MSXML2.IXMLDOMParseError

Set oDom = New DOMDocument

oDom.validateOnParse = False
oDom.async = False

oDom.Load "C:\Test.XML"

Set oError = oDom.parseError

If oError.errorCode <> 0 Then
MsgBox "Parse error!" & vbCr & _
"Error code: " & oError.errorCode & vbCr & _
"Reason: " & oError.reason & vbCr & _
"File: " & oError.url
Set oDom = Nothing
Exit Sub
End If

' Process the XML file

End Sub


--
Regards,
Lars-Eric Gisslén


"FredrikT" <[email protected]> skrev i meddelandet


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top