Micro Focus QTP (UFT) Forums
Updating xml through qtp - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Updating xml through qtp (/Thread-Updating-xml-through-qtp)



Updating xml through qtp - ankush - 03-13-2009

Hi
Is there any way we can update attribute values in an xml file through qtp?
I tried a few ways but was not able to do it...
1. Using XML checkpoint
2. Using excel format of xml

Suggestions invited!!
Thanks
Ankush


RE: Updating xml through qtp - Marc - 03-29-2009

In short:
- Load the XML in an XML-object by using XMLUtil
- Find the node you're looking for with ChildElementsByPath and GetRootElement()
- Updating element-values can be done with the SetValue method (but this is not what you're looking for, right?)
- I'm not sure if updating attribute-values can be done right away, but using RemoveAttribute and AddAttribute will do the trick

There's a little more to it than that, especially step 2, you can find details in QTP Help. And of course you have to understand how to use XPath.
Check out http://www.w3schools.com