如何使用vb动态创建xml文件
Dim objDom
Dim objRoot
Dim objMsg
Dim objField
Dim objFieldValue
Dim objattID
Dim objattTabOrder
Dim objPI
Dim x
Dim savepath
Dim xmlthing
Set objDom = Server.CreateObject("Microsoft.XMLDOM")
objDom.Async=False
xmlthing=objDom.Load(Server.MapPath("../xmldb/msg.xml"))
savepath=Server.MapPath("../xmldb/msg.xml")
If xmlthing= false Then
Set objRoot = objDom.createElement("msgs")
objDom.appendChild objRoot
Set objMsg=objDom.createElement("msg")
objRoot.appendChild objMsg
Set objField = objDom.createAttribute("name")
objField.Text = Request.Form("name")
objMsg.setAttributeNode objField
Set objFieldTime = objDom.createAttribute("time")
objFieldTime.Text =now
objMsg.setAttributeNode objFieldTime
Set objFieldValue = objDom.createElement("content")
objFieldValue.Text = Request.Form("content")
objMsg.appendChild objFieldValue
Set objPI = objDom.createProcessingInstruction("xml","version='1.0'")
objDom.insertBefore objPI, objDom.childNodes(0)
objDom.Save savepath