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,失敗的機會很大啊。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章