Overview: I am using StAX (Java) to parse an XML file. However, I need to be able to return to a specified position in the file (like marking a point in a stream).
Question: I was wondering whether there was a way to call a method to mark a position in a file, read some events but then have the reader move back to the mark.
Reasoning: I have xml statements such as:
<user>
<id>001</id>
<name>test</name>
<game>test game</game>
</user>
I would like to have the reader search through the file and when it finds a matching id or name I then need it to be able to go back and collect any required information on the user such as the game, etc. I am not experienced in XML but I assume that for a robust method, it must not depend on the order of the inner tags but rely purely on the basis that they are present. Is that right? If so then once a matching id is found, the reader must be able to go back and check each of the tags within the <user>
tag.
Many thanks