Wednesday, January 21, 2009

XML file creation

Set objXML = CreateObject ("Microsoft.XMLDOM")

'Create our root element using the createElement method
Set objXML.documentElement = objXML.createElement("SourceNode")

'Create Element and Node
Set objsrcl = objXML.createElement ("FirstNameAttribute") objXML.documentElement.appendChild objsrcl.cloneNode(true)
Set Node = objXML.documentElement.selectSingleNode("FirstNameAttribute")

' Create Attributes and assign values
Node.setAttribute "FirstNameAttribute", " Value"
Node.setAttribute "Second", "Value"
Node.setAttribute "third", "Value"
Node.setAttribute "Fourth","Value"
Node.setAttribute "Site", "Site"

'Save the file as XML
objxml.save "C:\CreatedXML.XML"

No comments:

Post a Comment