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\kmohankumar\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
Author:Mohan kakarla
3 Comments »
Leave a comment
-
Archives
- July 2011 (1)
- March 2011 (1)
- November 2010 (1)
- November 2008 (4)
- October 2008 (2)
- September 2008 (2)
- June 2008 (1)
- March 2008 (4)
- February 2008 (44)
-
Categories
- Automated Test Script Creation Process
- Automating MS Word
- Automating QC
- Automation Object Model For QTP
- Backward compatability in QTP
- Browser Scripts
- COM and QTP
- compare 2 text files
- Descriptive programming
- Descriptive Programming and Child Objetcs
- Dictonary Object
- DotNetFactory
- Excel Automation
- Extra Topics
- Files and Folders
- General Standards to be followed in Test scripts
- New Features In QTP9.5
- QC-OTA
- QTP Additional Faqs
- QTP Faqs
- QTP Naming Convention
- QTP Tips and Faqs
- Running stored procedures from QTP
- Send keyboard keys
- Uncategorized
- Uninstall a software using QTP
- Uninstall a software using vbscript
- Update data in a database
- VBScript and IE Automation
- VBScript Faqs and Useful resources
- What’s New in Quick Test Pro 9.0
- Whats New in QTP 9.5
- XML Scripting
-
RSS
Entries RSS
Comments RSS
Hi Mohan,
You have really done a great job out here. Really helpful to QTP professionals. I shall recommend it to scores of QTP people out here.
Comment by Abhilash Gopi | October 26, 2009 |
Hi Mohan,
I have a question with regards to this code. When i try creating the xml document, i get an error in QTP saying: “Object doesn’t support this property or method: ‘Create'”
My code so far:
Set myXmlWriter = DotNetFactory.CreateInstance(“System.Xml.XmlWriter”, “System.Xml”)
Set newXmlScript = myXmlWriter.Create(“C:\test.xml”)
Thank you for your help!
Comment by calvin | July 23, 2010 |
Hello Mohan Kumar Kakarla – Your website is very helpful. I am trying to do the following. Can you please tell me if this can be done, if so how
1. I want to use DotNetFactory and use TreeView Object and
display all the Nodes from a XML file below is the example
+ Feature one
+ Child Feature one
+ Child Feature two
+ Feature one
+ Child Feature one
+ Child Feature two
Comment by Shan Bollapragada | July 27, 2010 |