Read XML using Dotnet Factory
Set objReader = DotNetFactory.CreateInstance(“System.Xml.XmlReader”, “System.Xml”)
set XmlReader=objReader.Create(“C:\Documents and Settings\kmohankumar\Desktop\3.xml”)
while (XmlReader.Read())
If XmlReader.NodeType = “XmlDeclaration” or XmlReader.NodeType = “Element”Then
Reporter.ReportEvent micPass, “NodeType:”&XmlReader.NodeType &” Name :”& XmlReader.Name& ” is at Depth:”& XmlReader.Depth,””
If XmlReader.HasValue Then
Reporter.ReportEvent micPass, ” Value: “& XmlReader.Value,””
End If
Reporter.ReportEvent micPass, “Element:”& XmlReader.Name&” has attribute(s)”&”:”& XmlReader.AttributeCount,””
If XmlReader.AttributeCount > 0 Then
while XmlReader.MoveToNextAttribute()
fn = XmlReader.Name
ns = XmlReader.NamespaceURI
Reporter.ReportEvent micPass,” Attribute:”&fn &” Value: “& ns&” Attribute:”& XmlReader.GetAttribute(fn, ns),””
wend
End If
End If
wend
XmlReader.Close()
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,
Nice blog..publish you new content url at http://www.dotneturl.com and get reader and back link form us for free.
Comment by DotNetURL | November 27, 2008 |
Hi,
Nice blog …gud to see this kind of information….
I have to purchase QTP for functional testing… can you help me to purchase the same. Can u give me vendor details and suggest us for QTP version.
Comment by Vinayak | April 7, 2009 |
Hi Mohan,
For OpenOffice XML Form Document (.odt,sxw), do you have an idea for get attribute
and value of these file.
I try code following:
Dim agr()
Set oSM = CreateObject(“com.sun.star.ServiceManager”)
Set oDesk = oSM.createInstance(“com.sun.star.frame.Desktop”)
Set oDoc = oDesk.loadComponentFromURL(“file:///C:/test.odt”, “_blank”, 0, arg)
….
‘ I no idea how to get any attribute
….
Set oDesk = Nothing
Set oSM = Nothing
thank in advice
Comment by Manat | June 10, 2011 |