[XML-SIG] will SAX be suitable for this task?

Paul Prescod paul@prescod.net
Tue, 27 Jun 2000 12:12:03 -0700

Without pre-indexing or tree-building, an XML file is simply not a
random access data structure and cannot be processed in that way. No API
will allow you to go forward and then go backwards unless the API is
buffering and in that case, it will only be able to go backwards some
fixed number of records. Of course if your buffer is "the whole
document" (i.e. DOM) then you won't have any problems with going
backwards but you will have performance problems.

If you know in advance the maximum amount you need to go back, then you
could use PullDOM.

Otherwise, I would suggest a two-pass algorithm.
 Paul Prescod - Not encumbered by corporate consensus
When George Bush entered office, a Washington Post-ABC News poll found
that 62 percent of Americans "would be willing to give up a few of the
freedoms we have" for the war effort. They have gotten their wish.
	- "This is your bill of rights...on drugs", Harpers, Dec. 1999