2

What is the difference between:

Msxml2.DOMDocument
Msxml2.XMLHTTP

? And of course, the other question is which one will work best for my purpose as described below?

The context is this - I have code that makes many calls to retrieve web pages. I am looking for the most efficient object for this task. For example, something like this:

Dim oXmlHttp : Set oXmlHttp = CreateObject("MSXML2.XMLHTTP")

oXmlHttp.Open "GET", sUri, False
oXmlHttp.Send
If Err Then
    getWebPage = "ERROR - could not get the source text of the webpage."
    Exit Function
End If
sResponse = oXmlHttp.responseBody

This seems to work the same way if I create an object using:

Dim oXmlHttp : Set oXmlHttp = CreateObject("MSXML2.XMLHTTP")

Can anyone explain or point me to a reference that clearly outlines the differences (and intended usages) for each of those?

1 Answer 1

6

If you want to learn more about MSXML, these links may help:

In short, XMLHTTP is used to retrieve information, while DOMDocument is used to structure and parse it.

This page explains it better: http://msdn.microsoft.com/en-us/library/windows/desktop/ms760218(v=vs.85).aspx

DOMDocument "Represents the top node of the XML DOM tree." while XMLHTTP "Provides client-side protocol support for communication with HTTP servers."

Sign up to request clarification or add additional context in comments.

1 Comment

makes perfect sense, thanks for the point in the right direction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.