Automation Beyond

Testing and Test Automation for Software Quality Assurance. Above Requirements. Beyond Expectations. Methodologies and concepts. Framework Design. Programming and Scripting. Created by Albert Gareev.

QTP-XML service functions (3) – ChildAttributeByName

Posted by Albert Gareev on 2009/07/16

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

One Response to “QTP-XML service functions (3) – ChildAttributeByName”

  1. [...] Returns reference of XML Attribute [...]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>