如何跨浏览器读取xml文档
2009-10-03 14:53
344 查看
function createDocument() { var xmlDoc; if (window.ActiveXObject) { var versions = [ "Msxml2.DOMDocument.6.0", "Msxml2.DOMDocument.3.0" ]; for (var i = 0; i < versions.length; i++) { try { xmlDoc = new ActiveXObject(versions[i]); return xmlDoc; } catch (error) { //do nothing here. } } } else if (document.implementation && document.implementation.createDocument) { xmlDoc = document.implementation.createDocument("","",null); return xmlDoc; } return null; }
使用时,
var xmlDoc = createDocument();
xmlDoc.async = false;
xmlDoc.load("myfile.xml");
相关文章推荐
- 如何用JDom读取XML文档
- 编程技巧——c#.net mvc:如何读取xml文档
- Servlet如何从浏览器的表单获取中文信息并保存到磁盘的xml文档中不出现乱码
- [转]how to programatically access built-in properties of open xml word doc(如何读取open xml格式文档属性)
- JAVA操作XML(3)--读取XML文档的内容,并将内容显示在浏览器上
- 如何用JDom读取XML文档(转载)
- java中用jdom 如何读取xml文档
- ajax 如何 读取 xml 文档
- 如何读取XML文档 c#
- Cocos2dx 3.0 过渡篇(十一) xml文档的读取与调用
- JAVA读取XML练习,JAVA读取XML文档,JAVA解析XML文档,JAVA与XML,XML文档解析,SAX (Simple API for XML)
- XML解析之sax解析案例(一)读取contact.xml文件,完整输出文档内容
- 关于如何使用vc6.0读取xml文件中的内容
- spring如何从jar中读取applicationContext.xml配置文件?
- 如何从XML文件中读取数据绑定到DropDownList
- [VB.NET]vb.net如何读取数据库生成指定格式的xml文件
- Java是如何读取和写入浏览器Cookies的
- Jquery Ajax读取XML文档实现联动下拉框实例
- 如何用VB.net快速读取较大的xml文件
- PHP中使用XMLReader读取xml文档内容