I am trying to append xml file using vb script. Below is the code I wrote:
Dim xmlDoc
Dim objRoot
Dim objRecord
Dim objFieldValue
Set xmlDoc = _
CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = "False"
xmlDoc.Load("C:\Temp\Scripts_products.xml")
Set objRoot = xmlDoc.documentElement
Set objRecord = _
xmlDoc.createElement("Features")
objRoot.appendChild objRecord
Set objFieldValue = _
xmlDoc.createElement("ComputerName")
objFieldValue.Text = "atl-ws-100"
objRecord.appendChild objFieldValue
Set objFieldValue = _
xmlDoc.createElement("AuditDate")
objFieldValue.Text = Date
objRecord.appendChild objFieldValue
xmlDoc.Save "C:\Temp\Scripts_products.xml"
Below is the output I am getting:
</Product>
<Features xmlns=""><ComputerName>atl-ws-100</ComputerName> <AuditDate>1/19/2015</AuditDate></Features>
</Products>
How do I get of "" (Feature xmlns
instead of Feature xmlns=""
) which is coming in the feature tag.