javascript - 内置浏览器 DOM 解析器 VS。 Javascript 框架解析器

标签 javascript xml

我正在研究 javascript,我正在研究的概念之一是 XML 解析。我看到 IE 和 Firefox 一样有自己的解析器。我还看到一些 JavaScript 框架(如 JQuery)中内置了 XML 解析器。我的问题是...

  1. 目前使用 javascript 解析 XML 的最常见或最佳方法是什么?
  2. 如果我使用内置的 MS 和 Firefox 解析器,这是否意味着我的代码只能保证在 IE 和 Firefox 中工作,或者其他流行的浏览器也能工作?

提前感谢您的智慧!

编辑* 我刚找到 this discussion ,看起来与我的问题非常相似..

最佳答案

What's the most common or best way to parse XML using javascript these days?

我会使用框架解析器来避免根据浏览器编写代码。

If I use the built-in MS and Firefox parsers, does that mean my code is only guaranteed to work in IE and Firefox, or will the other popular browsers work as well?

每个浏览器都有自己的加载和操作 XML 的方式。

例如:

IE 使用 ActiveX 对象加载 XML,而 firefox 则不。

关于javascript - 内置浏览器 DOM 解析器 VS。 Javascript 框架解析器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1397687/

相关文章:

xml - 是否可以从XPath值列表和XML XSD构建XML文档?

xml - 找不到元素 'assignments' 的声明

Javascript,用Promises拼接FileReader处理大文件,怎么样?

xml - 使用 xmldom 编写句子时出现语法错误

javascript - 通过 jQuery 捕获具有特定数据切换的所有对象

javascript - 如何将 AutoNumeric 应用于所有选择器?

xml - Delphi 和 XML CDATA

c# - 使用 LINQ 从 XML 中选择多个节点

javascript - ES6 类私有(private)成员语法

javascript - 在 angularjs 中的 $scope 方法下,值未与 this.name 绑定(bind)