class REXML::Parsers::BaseParser

def peek depth=0

entire thing into memory) using this method.
event, so you can effectively pre-parse the entire document (pull the
Be aware that this causes the stream to be parsed up to the +depth+
stream and return the last event, which is always :end_document.
is at depth 0. If +depth+ is -1, will parse to the end of the input
Peek at the +depth+ event in the stack. The first element on the stack
def peek depth=0
  raise %Q[Illegal argument "#{depth}"] if depth < -1
  temp = []
  if depth == -1
    temp.push(pull()) until empty?
  else
    while @stack.size+temp.size < depth+1
      temp.push(pull())
    end
  end
  @stack += temp if temp.size > 0
  @stack[depth]
end