JavaScript中的XML / XSLT [英] XML/XSLT in JavaScript

查看:88
本文介绍了JavaScript中的XML / XSLT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究在JavaScript中使用XML和XSLT的例子,我不明白IE中不同选项之间的差异:

I've been looking into examples of using XML and XSLT in JavaScript and I don't understand the differences between the different options in IE:


  • Msxml2.DOMDocument.6.0

  • Msxml2.DOMDocument.3.0

  • Microsoft.XMLHTTP

  • Microsoft.XMLDom

  • Msxml2.DOMDocument.6.0
  • Msxml2.DOMDocument.3.0
  • Microsoft.XMLHTTP
  • Microsoft.XMLDom

所以当使用这种方法时:

So when using the approach:

var xml = new ActiveXObject("Xxxxxxx");

xxxxxx是上述变体之一。

With xxxxxx being one of the above variations.

我应该使用哪个?它们之间有什么区别?

Which should I use? What is the difference between them?

推荐答案

Microsoft基于COM的XML软件包称为MSXML,存在于不同的版本中,可以共同使用存在于Windows系统上。所有当前支持的Microsoft OS版本,最新支持的Microsoft OS Service Pack都附带MSXML 3和MSXML 6.在JX中为MSXML 3记录的传入 ActiveXObject 的程序ID这里: http://msdn.microsoft.com/en -us / library / ms766426%28v = vs.85%29 和MSXML 6: http://msdn.microsoft.com/en-us/library/ms764622%28v=vs.85%29 。正如您所看到的,以某种方式令人困惑的程序ID以'MSXML2'开头,并且MSXML版本在末尾附加,因此MSXML 3.0 DOM文档的程序ID MSXML2.DOMDocument.3.0 和MSXML 6.0 DOM文档程序ID Msxml2.DOMDocument.6.0

Microsoft's COM based XML software package is called MSXML and exists in different versions that can co-exist on a Windows system. All currently supported Microsoft OS versions respectively latest supported service packs of Microsoft OS come with MSXML 3 and MSXML 6. The program ids you pass in to ActiveXObject in JScript are documented for MSXML 3 here: http://msdn.microsoft.com/en-us/library/ms766426%28v=vs.85%29 and for MSXML 6 here: http://msdn.microsoft.com/en-us/library/ms764622%28v=vs.85%29. As you can see, somehow confusingly the program ids start with 'MSXML2' and the MSXML version is appended at the end so an MSXML 3.0 DOM document has the program id MSXML2.DOMDocument.3.0 and an MSXML 6.0 DOM document the program id Msxml2.DOMDocument.6.0.

程序ID以<开头code> Microsoft。是旧版MSXML版本中引入的遗留程序ID,如今MSXML 3和MSXML 6是操作系统的一部分或任何支持的操作系统上的最新服务,您不应该需要它们。

Program ids starting with Microsoft. are legacy program ids introduced with older MSXML versions, you shouldn't need them these days where MSXML 3 and MSXML 6 are part of the OS or latest service on any supported OS.

至于选择MSXML 3或6的版本,部分取决于你想做什么; MSXML 3和MSXML 6之间的主要区别在于MSXML 6具有支持针对模式或模式集进行验证的解析器,而MSXML 3仅支持基于DTD的验证。默认情况下,MSXML 6还有一些您需要注意的更严格的安全相关设置,请参阅 http://msdn.microsoft.com/en-us/library/ms754611%28v=vs.85%29

As for which version to choose of MSXML 3 or 6, that depends partly on what you want to do; the main difference between MSXML 3 and MSXML 6 is that MSXML 6 has a parser supporting validation against a schema or a schema set while MSXML 3 only supports DTD based validation. MSXML 6 by default also has some tighter security related settings you need to be aware of, see http://msdn.microsoft.com/en-us/library/ms754611%28v=vs.85%29.

由于您的帖子还提到了XSLT,MSXML 3和6都支持XSLT和XPath 1.0,因此在标准合规性方面,您可以选择其中任何一个,就性能而言可能会发现MSXML 6表现更好。

As your post also mentions XSLT, both MSXML 3 and 6 support XSLT and XPath 1.0 so in terms of standard compliance you can choose either of them, in terms of performance you might find that MSXML 6 performs better.

这篇关于JavaScript中的XML / XSLT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆