I can not find any peek or unread function in the XMLStreamReader documentation. What is the preferred way to get at least one token look ahead in order to parse a list of child elements as in the the HTML list for example?
<ul>
<li>
<li>
</ul>
When I create a recursive decent parser with parse functions for ul and li the li parse function has to terminate when it finds the closing tag of ul, but it must not consume it, because the ul parse function needs it to succeed.
I am used to solve such problems with peek or unread but they seem to be missing. What is the preferred Java way to solve this problem?
Update: I implemented the parser without look ahead using the XMLStreamReader.
There seems to be no straighforward way of doing this. Could you perhaps use the XMLEventReader to accomplish the same functionality?