I am attempting to find the value in an xml file based on searching with xpath to locate the node. The problem I am running into is that the ID for the node I am concerned about and the value I am looking for are siblings, thus I cannot walk the tree. I am wondering if there is a way to do this.
Here is an xml sample:
<class>
   <student rollno = "393">
      <firstname>Dinkar</firstname>
      <lastname>Kad</lastname>
      <nickname>Dinkar</nickname>
      <marks>85</marks>
   </student>
   <student rollno = "493">
      <firstname>Vaneet</firstname>
      <lastname>Gupta</lastname>
      <nickname>Vinni</nickname>
      <marks>95</marks>
   </student>
   <student rollno = "593">
      <firstname>Jasvir</firstname>
      <lastname>Singh</lastname>
      <nickname>Jazz</nickname>
      <marks>90</marks>
   </student>
</class>
Based on this example, I want to select the marks element for only Kad.
My xpath search for Kad works
//student/lastname[text()="Kad"]
I would expect then
//student/lastname[text()="Kad"]/marks
to return 85, but it fails saying it has an invalid token.
How do I select marks for "Kad" or ONLY any other student based on last name?
Updated code:
<IMPORT xmlns="urn:Import">
    <STUFF>
        <STUFF_TYPE>
            <STUFF_TYPE_KEY>1</STUFF_TYPE_KEY>
        </STUFF_TYPE>
        <WALMART>
            <STORE>
                <STORE_ID TYPE="SC" ID="SC-12345">WM000001</STORE_ID>
                <STORE_STATUS>O</STORE_STATUS>
            </STORE>
        </WALMART> 
    </STUFF>
</IMPORT>
It works for the student example, but not the walmart example
 
     
    