preload

p_GetXMLElementCDataByIndex (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Jul 23, 2008 | Categories: Source codeXML Data

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

Description

Get CData text from a child node specified by index.

Implementation

Private Function p_GetXMLElementCDataByIndex(ByRef objXMLElement, ByVal intIndex)
  Dim objColl, Iter, IndexIter

  Set objColl = objXMLElement.ChildNodes
  IndexIter = -1
  For Iter=0 To objColl.length-1
    If objColl.Item(Iter).NodeName = "#cdata-section" Then
      IndexIter = IndexIter + 1
      If IndexIter = intIndex Then
        p_GetXMLElementCDataByIndex = objColl.Item(Iter).NodeValue
        Exit Function
      End If
    End If
  Next
  p_GetXMLElementCDataByIndex = ""
  
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.