首先要介绍一个学习XML的非常好的网站
http://www.xmlfiles.com/
The MS XML parser is a COM component(组成部分) comes with MS IE 5.0.
The Microsoft XMLDOM parser features a language-neutral programming model that:(解析器对各种语言支持的属性)
The MS XML parser is a COM component(组成部分) comes with MS IE 5.0.
The Microsoft XMLDOM parser features a language-neutral programming model that:(解析器对各种语言支持的属性)
- Supports JavaScript、VBScript、Perl、VB、Java、C++ and more
- Suports W3C XML 1.0 and XML DOM
- Supports DTD and validation
Greate an XML document object:
JavaScript:
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM")VBScript
set xmlDoc = CreateObject("Microsoft.XMLDOM")ASP
set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")Loading an XML file into the parser
<script language="JavaScript"> var xmlDoc = new ActiveXObject("Microsoft.XMLDOM") //创建对象 xmlDoc.async="false" //告诉解析器当文档加载完成后才开始解析 xmlDoc.load("note.xml") //加载的文件路径 // ....... processing the document goes here </script>
Loading pure XML text into the parser(加载纯字符XML文档)
<script type="text/javascript">
var text="<note>"
text=text+"<to>Tove</to><from>Jani</from>"
text=text+"<heading>Reminder</heading>"
text=text+"<body>Don't forget me this weekend!</body>"
text=text+"</note>"
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.loadXML(text) //loadXML方法是用来加载纯字符的
// ....... processing the document goes here
</script>