Which version of MSXML should I use?

24,476

Solution 1

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:

Solution 2

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.

Solution 3

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

Solution 4

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"

Share:
24,476
Cheeso
Author by

Cheeso

I'm a longtime hacker and software practitioner. Creator of IIRF, DotNetZip, ReloadIt, CleanModQueue and a bunch of other Apigee-related tools and scripts. Maintainer of csharp-mode and a few other emacs-y things . I'm a Polyglot: Java, JavaScript, golang, a little PHP, C#, some VB.NET, C, XSLT, Powershell, elisp of course. Currently most of the work I do is JavaScript and NodeJS. I work for Google. We're hiring API geeks around the world. see: https://careers.google.com/jobs#t=sq&amp;q=j&amp;li=20&amp;l=false&amp;jlo=en-US&amp;j=apigee See my blog ...or my Github profile ...or my LinkedIn profile

Updated on July 09, 2022

Comments

  • Cheeso
    Cheeso almost 2 years

    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.