Currently I am facing problem to get the next instance of the tag.
“string(//*[local-name()=‘Id’]/text()[1])”. This dynamic Xpath prints the first instance of Id value.
But I need to get 2nd instance and 8th instances . How to achieve this?
I am using an xml file
Hello, I found this page:
Read and Deserialize an XML file
I’m thinking in the following way:
You can get the first item of an array of strings.
For an array can be also get a length property.
Or in a VB script the UBound function, or somehow
Then into an Invoke Code script you can parse each string.
Dim text() As String '' this can be the input argument
For Dim i = 0 To UBound(text) Step 1
Dim str As String = text(i)
Next i
Regards, Adrian
Hello, finally, I had found a workaround for this problem.
Use a Repeat activity and set a new String variable query.
CurrentItem is the current numeric index, or the position.
Using a Set Variable Value action, set the query string:
"//*[local-name=""Id""][position()=" + CurrentItem.toString + "]/text[1]"
I had tried with the next xml sample file:
Test.xml (286 Bytes)
The result from the Get XML Config action is a string result.
This can be displayed by a MessageBox.
Or can be added to a list, to an array, or to another string.
Please see the next picture:
Hope it helps, Adrian