Unfortunately, MSXML DOM (yet) does not support directly specifying timeout settings. If it possible for you to use ServerXMLHTTP (assuming you are not running on Win9x/Me and can use MSXML 3.0 and above), you can set the timeout properties, send a GET request for the XML file, and use the responseXML property as illustrated below:
Create a new Visual Basic 6.0 Standard EXE project, add reference to MSXML 3.0 type library, and write the following code in the Form_Load method:
Dim objSXH As New MSXML2.ServerXMLHTTP30
objSXH.setTimeouts 30000, 30000, 0, 0
objSXH.open "GET", "https://perfectxml.com/books.xml", False
objSXH.send
If objSXH.Status = 200 Then
MsgBox objSXH.responseXML.xml
Else
MsgBox "Error: " & objSXH.statusText
End If
The setTimeouts methods allows specifying resolveTimeout (30 seconds in the above code), connectTimeout (30 seconds above in the above code), sendTimeout (infinite timeout in the above code), and receiveTimeout (infinite timeout in the above code).
The responseXML property is of type DOMDocument and the parser does not populate this property (load the received XML document in it), unless we first access it. You can use the responseXML property as a DOMDocument object.
|