Skip to main content

Create XML using Dotnet Factory

Dim objWriter,XmlWriter
 Set objWriter = DotNetFactory.CreateInstance(“System.Xml.XmlWriter”, “System.Xml”)’ Creates the instance for the XMLWriter
 Set XmlWriter=objWriter.Create(“C:\Documents and Settings\Jay\Desktop\1234.xml”)’ creates xml document

 XmlWriter.WriteStartElement(“Books”)’ start writing the element
 XmlWriter.WriteStartElement(“Author”)

XmlWriter.WriteAttributeString “Name”, “Mohan”‘ writes  attributes and its values to the element
 XmlWriter.WriteEndElement()’ ends writing the element
 XmlWriter.WriteStartElement(“Title”)

XmlWriter.WriteAttributeString “Title1″, “QTP”‘
 XmlWriter.WriteEndElement()
 XmlWriter.WriteFullEndElement()

XmlWriter.close()

Set objWriter =Nothing

Comments