Which version of MSXML should I use?
Asked Answered
M

5

49

Seems like this would be a common question, though I could not find it on SO.

Which version of MSXML should I use in my applications, and more importantly, how should I decide?

There is MSXML3, 4, 5 and 6.

I recently posted some code in calling-wcf-service-by-vbscript that used MSXML v4. AnthonyWJones posted that I shouldn't use 4, but instead 3 or 6, but probably 3. Certainly not v5!

Why? I'd like to know more about the criteria for selecting the version of MSXML to use in my apps.

Bonus question: Does anyone have a summary of the differences between the various versions of MSXML over time?


Summary so far:

  • MSXML6
    Should be first choice. was released in 2006, and includes perf and compliance fixes. Use this if you can. It's good. There are no merge modules; to bundle the MSXML6 runtime with your app, MS suggests packaging the MSXML6 msi file. MSXML6 is an upgrade from MSXML3/4 but does not replace them, because it discontinues some features. You can get the MSI here.
  • MSXML3
    Second choice. Most widely deployed version. Originally shipped in March 2000. Actively maintained, no new features. Currently supported, if you are on SP5 (shipped in 2005) or later. SP7 is current (also from 2005).
  • MSXML5
    was released only as part of MS-Office. Currently supported by Microsoft, but only as part of Office, not for building apps. Don't build apps that depend on MSXML5: Verboten.
  • MSXML4
    originally shipped? Currently in "maintenance mode". Microsoft is encouraging people to move off MSXML4 to MSXML6. Currently supported if you are on MSXML4SP2 or later, which shipped in 2003. download MSXML4SP2 here. Can be redisributed.

Using the right version of MSXML in Internet Explorer is a good entry on the blog from Microsoft's xmlteam.

Moonstruck answered 4/6, 2009 at 16:56 Comment(0)
S
25

If you need to support Windows OS versions prior to Win2k, then use MSXML3. Otherwise, use MSXML6.

MSXML4 is in maintenance mode.
MSXML5 was never actually supported for use outside of MS-Office.

See:

Swarthy answered 4/6, 2009 at 17:2 Comment(3)
So the right answer for me, seeing that I don't deploy anything on Win98, or even win2000, is MSXML6.Moonstruck
Note that if you are using MSXML6 in Windows 8.1 64-bit, you may need to qualify the version number in your code (I didn't and it was throwing undefined reference errors), e.g.: Dim XMLHttpReq As MSXML2.XMLHTTP60 instead of Dim XMLHttpReq As MSXML2.XMLHTTP. If you are passing parameters, use XMLHttpReq As XMLHTTP60 instead of XMLHttpReq As XMLHTTP.Elative
It's been a while since I've worked with this... But IIRC, MSXML2.XMLHTTP never pointed to MSXML6 - you'd get an older version (probably 3). Since 6 had a lot of breaking changes, you needed to explicitly request it (as then you'd presumably test your code against it before shipping).Swarthy
M
13

I had to make the same decision in my work a couple of years ago.

The MSDN states that version 6 is the optimal one to use, however they don't provide merge modules in the SDK and you are not allowed to distribute it in your application as you could with version 4. Version 4 was superceded by version 6 and version 5 was specifically for MS Office. Version 3 remains the target version on older machines.

What I ended up doing was taking a graceful degradation approach and attempting to use 6 first, failing that version 4, then failing that use version 3 (code is C++):

inline bool CXMLDocument::CreateXMLDOMFactory(void)
{
    wxMutexLocker lock(sm_mXMLDOMFactory);

    if(!sm_pXMLDOMFactory)
    {
        ::CoGetClassObject(CLSID_DOMDocument60, CLSCTX_ALL, 0, IID_IClassFactory, reinterpret_cast<void **>(&sm_pXMLDOMFactory));
        if(!sm_pXMLDOMFactory)
        {
            ::CoGetClassObject(CLSID_DOMDocument40, CLSCTX_ALL, 0, IID_IClassFactory, reinterpret_cast<void **>(&sm_pXMLDOMFactory));
            if(!sm_pXMLDOMFactory)
                ::CoGetClassObject(CLSID_DOMDocument30, CLSCTX_ALL, 0, IID_IClassFactory, reinterpret_cast<void **>(&sm_pXMLDOMFactory));
        }
    }

    return sm_pXMLDOMFactory != 0;
}

We noticed measurable performance improvements after moving to version 6 from version 4, although you have to explicitly set the NewParser property on the document to get this benefit, e.g.:

pDocument->setProperty(_bstr_t(L"NewParser"), VARIANT_TRUE);

There were also a couple more hoops to jump through when loading documents due to security considerations, remote DTDs and so on. Again, this was done via properties on the document, so it is worth looking up the ProhibitDTD, UseInlineSchema, AllowXsltScript and ServerHTTPRequest properties in the MSDN to see if they apply to your usage.

Mai answered 4/6, 2009 at 17:10 Comment(1)
It is generally a bad idea to work backwards by version number. If MSXML6 is not available, MSXML3 is generally the best fallback. This was taken from official Microsoft doc: msdn.microsoft.com/en-us/data/bb291077.aspxStepper
P
2

Here's a list of all the versions. There is a decent discussion of the differences on Wikipedia.

Pampero answered 4/6, 2009 at 17:5 Comment(0)
D
2

Seems that MSXML 5 is the only version able to sign digitally a XML. MS site says that even MSXML 6 can't do it so, if you need this feature, seems that MSXML 5 is the only way to go.

http://msdn.microsoft.com/en-us/library/ms761363(VS.85).aspx " This sample code uses features that were implemented in MSXML 5.0 for Microsoft Office Applications. XML digital signatures are not supported in MXSML 6.0 and later"

Derma answered 22/3, 2010 at 17:10 Comment(0)
T
0

I recently created a JS library that tried to degrade gracefully from the latest version to the oldest. I found that MSXML 3.0 is very well supported on most systems. I had wanted to use v. 6.0 when available, but it broke on some IE 8 installations. So, I had to change my code to try v 3.0 first and then v 6.0 and then v 2.0.

Typehigh answered 4/6, 2009 at 17:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.