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
投稿

猜你喜欢

  • 关于ORACLE通过file_id与block_id定位数据库对象遇到的问题引发的思考

    2024-01-18 11:01:08
  • Javascript this 关键字 详解

    2024-06-07 15:51:18
  • python通过cookie模拟已登录状态的初步研究

    2022-10-25 08:20:46
  • python机器学习实现决策树

    2021-04-21 07:44:34
  • 在 Python 中如何将天数添加到日期

    2023-02-09 03:34:30
  • Jquery 组合form元素为json格式,asp.net反序列化

    2024-05-21 10:11:56
  • Vue中的 DOM与Diff详情

    2023-07-02 16:32:37
  • golang中defer的使用规则详解

    2023-07-21 22:47:31
  • 对tensorflow中的strides参数使用详解

    2022-06-12 06:00:38
  • python利用hook技术破解https的实例代码

    2021-10-24 17:20:15
  • PostgreSQL COALESCE使用方法代码解析

    2024-01-28 19:55:01
  • Python 实用技巧之利用Shell通配符做字符串匹配

    2021-07-18 22:57:16
  • gRPC超时拦截器实现示例

    2024-04-27 15:30:54
  • flask框架配置mysql数据库操作详解

    2024-01-14 05:31:57
  • jQuery 1.4 Released 新特性官方诠释

    2010-04-01 12:23:00
  • ASP.NET中URL Routing和IIS上URL Rewriting的区别

    2024-06-05 09:25:27
  • MySQL字符集乱码及解决方案分享

    2024-01-21 12:00:43
  • 通过js脚本复制网页上的一个表格的不错实现方法

    2024-04-23 09:16:19
  • python数据预处理 :数据共线性处理详解

    2022-06-29 09:46:24
  • 使用Python操作MySQL的一些基本方法

    2024-01-18 19:16:55
  • asp之家 网络编程 m.aspxhome.com