XMLDOM学习
- 作者:xiaoxiao
- 发表时间:2020-12-23 10:54
- 来源:未知
XMLDOM中获得树中某个节点的方法:nodeFromID和getElementByTagNamei.e:dim domdim nodelist As XMLDOMNodeListdim node As XMLDOMNodeDim i as Integer,length as integerset dom = CreateObject("microsoft.xmldom")doc.async = falsedom.load("filename.xml")set nodelist = dom.getElementByTagName("Page")length = nodelist.lengthfor i=0 to length set node = nodelist.item()i MsgBox node.xmlnext
在XML文档中添加一个节点set node = rootNode.childNodes.item(0)set newNode = myDocument.createElement("publisher")set rtnNode = node.insertBefore(newNode,node.lastChild)set textNode = myDocument.CreateTextNOde("人民邮电出版社")node.childNodex.item(1).appendChild(textNode)