GetChildElementValueByAttr (QTP, TestComplete, VBScript)
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript)
Description
Returns text value of a child XML node found via XPath query.
Implementation
Public Function GetChildElementValueByAttr(ByRef objXMLParent, ByVal sTagName, ByVal sAttrName) Dim objNode sTagName = Trim(sTagName) sAttrName = Trim(sAttrName) If objXMLParent is Nothing Then GetChildElementValueByAttr = "" Exit Function End If Set objNode = objXMLParent.SelectSingleNode("./"&sTagName&"[@name='" & sAttrName &"']") If isNull(objNode) or (objNode is Nothing) Then GetChildElementValueByAttr = "" Else GetChildElementValueByAttr = p_GetXMLElementText(objNode) End If End Function