您的当前位置:首页VBS生成XML文件

VBS生成XML文件

2021-03-12 来源:乌哈旅游


VBS生成XML文件

Dim xmlDoc, rootEl, child1, child2, p

'创建XML文档

Set xmlDoc = CreateObject("MSXML2.DOMDocument")

'创建根元素并将之加入文档

Set rootE1=xmlDoc.createElement("BookStore")

xmlDoc.appendChild rootE1

'创建并加入子元素

Set bookchild1=xmlDoc.createElement("book")

Set ISDNAttribute=xmlDoc.createAttribute("ISDN")

ISDNAttribute.text="789456123"

bookchild1.setAttributeNode ISDNAttribute

Set bookchild1_title=xmlDoc.createElement("title")

bookchild1_title.text="C#"

bookchild1.appendChild bookchild1_title

Set bookchild1_author=xmlDoc.createElement("author")

bookchild1_author.text="BXH"

bookchild1.appendChild bookchild1_author

Set bookchild1_price=xmlDoc.createElement("Price")

bookchild1_price.text="29.3"

bookchild1.appendChild bookchild1_price

rootE1.appendChild bookchild1

'创建并加入子元素

Set bookchild2=xmlDoc.createElement("book")

Set ISDNAttribute=xmlDoc.createAttribute("ISDN")

ISDNAttribute.text="789457898"

bookchild2.setAttributeNode ISDNAttribute

因篇幅问题不能全部显示,请点此查看更多更全内容