Since you can assume parsing goes in one direction, you could store a pointer to where you were in the node list so you don't have to start over again.  simple/stupid but it should work?