HI
I have an xml that looks like this (its part of a config file)
Code:
<CartIndexes>    
  <Cart>    
        <ID> 1</ID>   
     <Restricted>    
        <casetype>DV</casetype>    
        <casetype>SV</casetype>    
      </Restricted>    
</Cart>    
</CartIndexes>   
   
<CartIndexes>    
  <Cart>    
        <ID> 2</ID>   
     <Restricted>    
        <casetype>LV</casetype>    
        <casetype>PV</casetype>    
        <casetype>GV<casetype>  
      </Restricted>    
</Cart>    
</CartIndexes>
The ID value changes dynamcally and is part of a variable

Now how should I get the casetype values based on the ID values?

I wrote the following code but it gives all the casetype values in the XML instead of based on ID value.

so I want to get casetype values when ID=1 , 2, 3...etc ...but ID values are part of a variable so //CartIndexes/Cart[ID=1]/Restricted is not going to work

Code:
nodes = nav.Select("//Cart")  
        While nodes.MoveNext()  
            courtcd = nodes.Current.SelectSingleNode("ID").Value  
            If Not indexHash.Contains(id) Then  
                indexHash.Add(courtcd, New List(Of CourtIndexInfo)())  
            End If  
If nodes.Current.SelectSingleNode("Restricted") Is Nothing Then  
                '*--------------------------------------------------  
            Else  
                '*** Verify config entries exist ***'  
              Dim nodePath As XPathNodeIterator = nav.Select("Restricted/casetype")  
                 Do While nodePath.MoveNext
                    ReDim Preserve casetype(i)
                    casetype(i) = nodePath.Current.InnerXml
                Loop
End IF