Which version of MSXML should I use?

前端 未结 5 1906
Happy的楠姐
Happy的楠姐 2020-11-30 01:40

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,

相关标签:
5条回答
  • 2020-11-30 02:07

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

    0 讨论(0)
  • 2020-11-30 02:12

    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:

    • List of Microsoft XML Parser (MSXML) versions
    • Using the right version of MSXML in Internet Explorer
    0 讨论(0)
  • 2020-11-30 02:12

    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.

    0 讨论(0)
  • 2020-11-30 02:15

    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"

    0 讨论(0)
  • 2020-11-30 02:17

    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.

    0 讨论(0)
提交回复
热议问题