Working with XML in UFT (but not a checkpoint) – Read, Use data, etc.
Question ID: 107020
0
0

I'm trying to work with an XML file in UFT, but I don't want to just do a checkpoint. What can I do to be able to open an XML file and read in data from tags if I want. Again…not just do a checkpoint?

Marked as spam
Posted by (Questions: 227, Answers: 22)
Asked on July 30, 2016 10:10 pm
266 views
Answers (3)
0
Private answer

Well, you are in luck. Because UFT enables you to use third party API's, you can use the Microsoft XMLDOM object and do exactly what you are seeking, Since we are talking about an API with lots of methods and properties, it's going to be too much to go to in this post, but I want to suggest that you check the following link on MS's site that documents everything about this object model. You can also Google XMLDOM object and find lots of examples.

https://msdn.microsoft.com/en-us/library/aa468547.aspx

Marked as spam
Posted by (Questions: 2, Answers: 477)
Answered on July 30, 2016 10:11 pm
0
Private answer

Thanks! What if we have namespaces in our XML docs, though? Is this still going to work?

Marked as spam
Posted by (Questions: 227, Answers: 22)
Answered on July 30, 2016 10:14 pm
0
Private answer

Possbily. Check out the following link from Microsoft. This is what they have to say about it:

''The XML Document Object Model (DOM) is completely namespace-aware. Only namespace-aware XML documents are supported. The World Wide Web Consortium (W3C) specifies that DOM applications that implement Level 1 can be non-namespace-aware, and DOM Level 2 features are namespace-aware. However, all features in the XML DOM are namespace-aware, regardless if the method is from the Level 1 or Level 2 DOM Recommendation.

For example, in a non-namespace-aware setting, calling setAttribute(''A:b'', ''123''), as specified in the DOM Level 1 Recommendation, does not result in an attribute with a prefix of A and a local name of b. It would result in an attribute with the value A:b.

In a namespace-aware environment, the call to the DOM Level 2 setAttribute(''A:b'', ''123'') results in an attribute with a prefix of A and a local name of b. This is how the Microsoft .NET Framework DOM works.''

https://msdn.microsoft.com/en-us/library/w86a6hab(v=vs.110).aspx

Marked as spam
Posted by (Questions: 2, Answers: 477)
Answered on July 30, 2016 10:17 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top