Micro Focus QTP (UFT) Forums
Reading XML document from 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: Reading XML document from QTP (/Thread-Reading-XML-document-from-QTP)



Reading XML document from QTP - sailakshmi - 08-23-2008

Hi,

Can anyone tell me using QTP how to read XML values which has multi level nodes, parent, child and store it in a buffer for furture use?
Code:
<root>
      <Parent1> <Parent2> <Parent3>
         <child1>,<child2>,<child3>,....
                <Grandchild1><Grandchild2><Grandchild3>
Thanks,
Sai


RE: Reading XML document from QTP - vamshiram - 09-09-2008

Code:
<Environment>
- <Variable>
  <Name>Path</Name>
  <Value>C:\Documents and Settings\TulasiV\My Documents\Vamshidoc\</Value>
  </Variable>
- <Variable>
  <Name>DataBase</Name>
  <Value>MDB</Value>
  </Variable>
- <Variable>
  <Name>TestCaseID</Name>
  <Value>1</Value>
  </Variable>
- <Variable>
  <Name>TestCaseDiscription</Name>
  <Value>1-QuickSearchRun_03-Sep-08_15-45-27</Value>
  </Variable>
  </Environment>


The above is my XML structure, I am reading the value using the following code, for the XML path I am using the environment variable.

Code:
XMLpath =Environment.Value("QTPxmlPath")


Environment.LoadFromFile =(XMLpath&"\Vamshi.xml")

TestCaseID=Environment.Value("TestCaseID")