views:

1357

answers:

5

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.

+7  A: 

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:

Shog9
So the right answer *for me*, seeing that I don't deploy anything on Win98, or even win2000, is MSXML6.
Cheeso
@Cheeso: correct.
Shog9
A: 

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.

Cerebrus
+1  A: 

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

JP Alioto
+3  A: 

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.

Phil Booth
Thanks, I would vote this up more if I could.b
Cheeso
A: 

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"

WarmBooter