I'm trying to save all the repeated nodes to an array for my QTP automation.
When we use the below code we get all the repeated nodes present in the XML. Example:
strXmlPCoverage = /cts:InsuranceClaim/cts:MedicalClaim
Set nodes = xmlDoc.SelectNodes(strXmlPCoverage)
PathLength = nodes.Length
Let's say the PathLength returned "6" tags present in the XML as repeated tags.
/cts:InsuranceClaim/cts:MedicalClaim[0] /cts:InsuranceClaim/cts:MedicalClaim[1] /cts:InsuranceClaim/cts:MedicalClaim[2] /cts:InsuranceClaim/cts:MedicalClaim[3] /cts:InsuranceClaim/cts:MedicalClaim[4] /cts:InsuranceClaim/cts:MedicalClaim[5]
Now I want to save all those 6 different paths to array. I'm not able to identify the property that displays the values stored in nodes.
Set nodes = xmlDoc.SelectNodes(strXmlPCoverage)
PathLength = nodes.Length
For Each NodeItem In nodes
ArrAllNodes(i) = NodeItem.nodeValue
Next
The above code stores value of that node to Array instead of the node itself. Can you please help me how to store the nodes to array instead of node values
Output displayed by the code:
ArrAllNodes(0) = abc
ArrAllNodes(1) = xyz
...
Output Expected:
ArrAllNodes(0) = /cts:InsuranceClaim/cts:MedicalClaim[0]
ArrAllNodes(1) = /cts:InsuranceClaim/cts:MedicalClaim[1]
...