preload

QTP-XML service functions (3) – ChildAttributeByName

Posted by Albert Gareev on Jul 16, 2009 | Categories: Source codeXML Data


Parent page: Service Functions – XML (QTP, VBScript) 

Description

Returns XML child attribute (as XMLAttribute object reference) specified by a name. Attribute name duplication within the same node is not allowed by XML rules. If there is no attribute with the name specified then “Nothing” is returned.

Public Function ChildAttributeByName(ByRef objXMLParent, ByVal sAttrName)
	Dim objColl, objAttr

	If objXMLParent is Nothing Then
		Set ChildAttributeByName = Nothing
		Exit Function
	End If

	Set objColl = objXMLParent.Attributes()
	Set objAttr = objColl.ItemByName(sAttrName)

	Set ChildAttributeByName = objAttr

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.