preload

ChildAttributeValueByName (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Sep 08, 2012 | Categories: Source codeXML Data

Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript)

Description

  • Returns text value of node’s child attribute specified by name.
  • Valid arguments: an XML element node (NODE_ELEMENT type), name of the attribute.
  • If XML node is not defined, returns empty string.
  • Uses private function p_GetXMLElementAttrText, defined within the library (see parent page).

Implementation

Public Function ChildAttributeValueByName(ByRef objXMLNode, ByVal sAttrName)
  If objXMLNode is Nothing Then
    ChildAttributeValueByName = ""
    Exit Function
  End If
  sAttrName = Trim(sAttrName)
  ChildAttributeValueByName = p_GetXMLElementAttrText(objXMLNode, sAttrName)
End Function

Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
This work by Albert Gareev is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported.