MSXML2家族探秘

时间:2008-03-03 12:35:00 

客户端程序编写免不了经常接触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 functionality.

如何探测

这么多的实现,哪我们如何探测呢?一般来说,我们应该尽量采用更新的更常用的版本。
我的选择是(摘自JSI内核源码):

if(this.ActiveXObject && !this.XMLHttpRequest ){
var xmlHttpRequstActiveIds = [
"Microsoft.XMLHTTP"//IE5的,最早的XHR实现
,"MSXML2.XMLHTTP"
//,"MSXML2.XMLHTTP.3.0"//应该等价于MSXML2.XMLHTTP
//,"Msxml2.XMLHTTP.4.0"
,"Msxml2.XMLHTTP.5.0"
//,"Msxml2.XMLHTTP.6.0"
];
var xmlHttpRequstActiveId
this.XMLHttpRequest = function(){
if(xmlHttpRequstActiveId){
return new ActiveXObject(xmlHttpRequstActiveId);
}else{
var i=xmlHttpRequstActiveIds.length;
while(i --){
try{
var impl = new ActiveXObject(xmlHttpRequstActiveId = xmlHttpRequstActiveIds[i]);
xmlHttpRequstActiveIds = null;
return impl;
}catch (e){}
}
}
};
}
标签:xmlhttp,xml,微软
0
投稿

猜你喜欢

  • (X)HTML的文档结构

    2008-06-30 12:25:00
  • CSS中写expression可能会在Chrome中有问题

    2010-01-29 13:10:00
  • Windows下对MySQL安装的故障诊断与排除

    2008-12-17 16:50:00
  • JavaScript 颜色梯度和渐变效果

    2009-03-18 11:16:00
  • SQL Server中使用DTS设计器进行数据转移

    2009-01-08 16:15:00
  • CSS sprites图片拼合生成器

    2007-10-15 12:25:00
  • JavaScript性能优化--创建文档碎片

    2009-12-04 12:41:00
  • asp根据出生时间判断生肖

    2008-03-24 19:49:00
  • 自动清空站点目录下所有文件

    2009-06-24 11:11:00
  • ASP编码问题的深入研究与解决方案(MSDN)

    2007-10-25 11:54:00
  • 简要介绍SQL Server 2008新的事件处理系统

    2009-12-22 08:15:00
  • ASP内置对象Request和Response用法详解

    2007-09-14 10:35:00
  • 在ASP中使用SQL语句之12:连接

    2009-04-23 18:27:00
  • 如何正确处理ajax 302跳转问题回博客首页

    2009-02-28 14:01:00
  • 如何对Mysql 数据表压缩

    2010-11-25 17:21:00
  • 对抗MySQL数据库解密高手

    2008-12-25 13:14:00
  • 彻底终结浏览器Cache页面的解决方案

    2008-04-21 15:10:00
  • SQL Server开发过程中的的常见问题总结

    2009-01-06 11:16:00
  • Microsoft Access 数据库常规规格

    2007-09-27 19:28:00
  • 提高MySQL查询效率的三个技巧

    2009-02-11 13:19:00
  • asp之家 网络编程 m.aspxhome.com