天天看點

MSXML2家族探秘

用戶端程式編寫免不了經常接觸XMLHttpRequest對象。

微軟的XHR實作的progid又是一串一串的。 煩人。抽一個中午時間,找了找資料,整理記錄如下:

"Microsoft.XMLHTTP"

最早的XHR實作。微軟官網上說這是MSXML 2.x系列版本的progid。

2.x 系列progid是不帶版本号的。看起來簡單清楚。

引用:

MSXML 2.6 was shipped with SQL Server 2000 and MDAC 2.6 and is provided in Windows or other service pack updates provided by Microsoft.

MSXML 2.6 installs in replace mode only.

"MSXML2.XMLHTTP"

MSXML 3.0 的progid,

"MSXML2.XMLHTTP.3.0"

也是MSXML 3.0 的,應該等價于MSXML2.XMLHTTP;這時,可能是感覺到那種不帶版本号的progid,在更新後造成的相容性問題,以後的更新版本的progid都可以帶上版本好嗎。

引用:

MSXML 3.0 is provided as a required component with a number of Microsoft products, such as Microsoft Visual Studio and Microsoft Office. It is also a system component for current versions of Microsoft Windows.

MSXML 3.0 SP2 or later installs in replace mode only. (Note: you do not need to run xmlinst.exe utility when updating to this version of MSXML 3.0)

"Msxml2.XMLHTTP.4.0"

此後的版本,都帶上了版本号碼,可能是為了應對程式員懶散的習慣(不喜歡帶那個版本号),不提供以前那種無版本字尾的progid了。

引用:

MSXML 4.0 is a separate download that was released by Microsoft in October 2001. The latest or current service pack release of MSXML 4.0 is available through the Microsoft Web site. MSXML 4.0 must be installed separately and is not currently included with other Microsoft products.

MSXML 4.0 installs side-by-side with earlier versions of MSXML without affecting any existing functionality.

“Msxml2.XMLHTTP.5.0"

引用:

MSXML 5.0 for Microsoft Office Applications is only available with current versions of Microsoft Office.

MSXML 5.0 for Microsoft Office Applications installs side-by-side with earlier versions of MSXML without affecting any existing functionality.

"Msxml2.XMLHTTP.6.0"

引用:

MSXML 6.0 is a separate download that was released by Microsoft in November 2005. The latest or current service pack release of MSXML 6.0 is available through the Microsoft Web site. MSXML 6.0 must be installed separately. It is included with SQL Server 2005.

MSXML 6.0 installs side-by-side with earlier versions of MSXML without affecting any existing functionalit根據ie blog的建議,應該僅使用6.0和3.0。ie團隊建議不要使用老的microsoft.xmlhttp,說這僅為相容而保留,那個意思似乎是,如果你安裝過了msxml 3.0,用microsoft.xmlhttp所産生的其實也是3.0版而不是2.6版的。 

但是4.0之後似乎抛棄了replace模式,而改用版本号了。并且MSXML2.XMLHTTP會始終對應3.0,而不會選取可用的最新版本。 

從各種小道新聞來看,6.0是繼承3.0的,并由一個團隊所開發。而4.0和5.0的開發并非主要針對浏覽器的,屬于旁支,存在一定的相容問題,其中5.0是為office所開發的,甚至帶有一些特性是後來的6.0所沒有的(如xml數字加密)。 

此外在使用6.0時,還需要注意一個問題。就是ie7所帶的native xmlhttprequest貌似是基于3.0而不是6.0的,而不同版本的xml節點是不能被互相插入和移動的。是以activex的6.0和native xhr不可互用。當然這一點我還沒有驗證測試過。

說到IE7的native XHR,我感覺到的與其他版本最大的差別是本體測試的時候它不能通路相對路徑下的本地檔案系統,有點麻煩。

另外,6.0貌似隻有ie7支援吧,我在IE6上都沒成功過。

IE7使用者那麼少,首先探測6.0,失敗的機會很大啊。

繼續閱讀