from the following code how to get the child element value only once. i.e when i parse from root-> parent-> child -> i need to loop for child element tag to get all child element value then parse to end of parent and end of root. i do not want to go to next parent -> next child.
<root>
<parent>
<name>g</name>
<child>child1</child>
<child>child2</child>
<child>child3</child>
</parent>
<parent>
<name>s</name>
<age>23</age>
<child>child1</child>
<child>child2</child>
<child>child3</child>
</parent>
<parent>
<name>t</name>
<child>child1</child>
<child>child2</child>
<child>child3</child>
</parent>
Here, I need to get the child element values only once without parsing whole file. while i write xml file i know these elements values are same for all the parent node. in this scenario, how to get child1,child2,child3 from the above file.