0

如何从所有这些节点中检索所有有效的 XPATH?

----------------示例 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>

对于上述 XML,输出将是:

XPATH for name = "/name"
XPATH for documentId = "/document/documentId"
XPATH for firstname = ""/document/NameDetail[1]/firstname"
XPATH for firstname = "/document/NameDetail[2]/firstname"
4

1 回答 1

0

QTP 不支持从 XML 文档中提取 XPath,您必须自己将其作为普通的 VBScript 进行,也许通过使用 Microsoft 的XMLDOM 对象

Set xmlDoc = CreateObject( "Microsoft.XMLDOM" )
于 2012-07-23T13:36:24.010 回答