0

How can i retrieve all the valid XPATH from all these node?

----------------Sample XML---------------------

<name version="1.0">
<document>
<documentId>0107</documentId>
<NameDetail>
<firstname>SAM</firstname>
<internalreferenceNumber>12345</internalreferenceNumber>
</NameDetail>
<NameDetail>
<firstname>TECHNO</firstname>
<internalreferenceNumber>12346</internalreferenceNumber>
</NameDetail>
</document>
</name>

For the Above XML, the Output would be :

XPATH for name = "/name"
XPATH for documentId = "/document/documentId"
XPATH for firstname = ""/document/NameDetail[1]/firstname"
XPATH for firstname = "/document/NameDetail[2]/firstname"
Sam
  • 543
  • 3
  • 10
  • 27
  • What do you mean _retrieve XPATH_? There can be any number of XPath expressions that describe an XML element. Please add the expected results you want from QTP in this case. – Motti Jul 23 '12 at 12:49
  • I have updated my questions with more details itself. – Sam Jul 23 '12 at 13:07

1 Answers1

0

QTP does not support extracting XPaths from XML documents you would have to do so yourself as plain VBScript perhaps by using Microsoft's XMLDOM object.

Set xmlDoc = CreateObject( "Microsoft.XMLDOM" )
Motti
  • 110,860
  • 49
  • 189
  • 262
  • I agree that we need to do it using XMLDOM parser. But it is a huge tidy work :) – Sam Jul 23 '12 at 15:36