Which version of MSXML should I use?

萝らか妹 提交于 2019-11-27 06:57:33

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:

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.

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

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"

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!