I am trying to grab the elements of index 3 and 4 in the following xml:
<Automated>
<Group>
<Test><id>testId</id>...</Test>
<Test>...</Test>
<Test>...</Test> <!-- 3? -->
</Group>
<Test>...</Test> <!-- 4? -->
</Automated>
As far as I was aware, the expression //x
was used to grab all elements with type x
. The expression I was attempting to use to grab the 3rd and 4th elements is:
//Test[3] , //Test[4]
However, element //Test[4]
does not return anything. Upon further investigating, I've realized that //Test[1]
will actually return both elements 1 and 4. Which is actually the first child of the first element, and the second (first test?) child.
Is there any way to achieve what I want to do?
The only other thing that I can think of to do (since I'm using this in c# and have access to scripting this) is using a counter to iterate through all possible selections of //Test[x] and then index it myself. However, that seems like more work than is necessary.