vbs访问xml文件
上一篇 /
下一篇 2011-08-15 16:42:11
/ 个人分类:VBScript
xml文件
<bookstore>
51Testing软件测试网/Mw[,O;YS}A
~z <book category="children">
51Testing软件测试网yi#X5yL/z <title lang="en">9898</title>
I_ ^#cOG`4AQ:b0 <author>J K. Rowling</author>
51Testing软件测试网H wq+B6|],c <year>2005</year>
:\6{d.O]0 <price>29.99</price>
51Testing软件测试网C1Bh I)v/~5` </book>
51Testing软件测试网9?u H C
G
Om A <book category="cooking">
;[V2G7M9Ox0 <title lang="en">Everyday Italian</title>
51Testing软件测试网1j"Q+IK7U-] <author>Giada De Laurentiis</author>
51Testing软件测试网
X7LQ O
j B\ <year>2005</year>
(^s ~1y
S C)a0 <price>30.00</price>
51Testing软件测试网pZ:p;JsA*[+fk </book>
51Testing软件测试网6I6xh8cfaeA <book category="
web" cover="paperback">
X fNQmU
M0 <title lang="en">Learning XML</title>
,Npzj h#T#h0 <author>Erik T. Ray</author>
51Testing软件测试网 Az(Q'xA <year>2003</year>
51Testing软件测试网N#jT`vK)e uF*G <price>39.95</price>
51Testing软件测试网k#z^BtsfU </book>
(f6e4tW qO])f0</bookstore>
通过节点之间的关系来查找51Testing软件测试网nI;cQ A8mc\
Set xmldoc=CreateObject("microsoft.xmldom")
'建立xmldom对象及加载
c%K}@ iGD9}0xmldoc.load("d:\123.xml")
6Y?Zp(w3C0Set x=xmldoc.documentElement.firstChild.firstChild.nextSibling.childNodes(0)
'返回为J K. Rowling
G_Du5jJA [0MsgBox x.nodeValue
通过getelementbytagname查找,tagname为元素节点的标签,只能用来查找元素节点