class REXML::Parsers::SAX2Parser

def listen( *args, &blok )

See the SAX2Listener for more information.
be, where the method name is the same as the matched Symbol.
Block will be passed the same arguments as a SAX2Listener method would

Listener must implement the methods in SAX2Listener

against fully qualified element names.
Array contains regular expressions or strings which will be matched

stream position.
This will be called for every event generated, passing in the current
There is an additional symbol that can be listened for: :progress.

:entitydecl, :notationdecl, :cdata, :xmldecl, :comment
:processing_instruction, :doctype, :attlistdecl, :elementdecl,
:start_prefix_mapping, :end_prefix_mapping, :characters,
Symbol can be one of: :start_element, :end_element,

Listen to All events
Listener
Listen to :start_element events on Array elements
Array, Block
Listen to all events on Array elements
Array, Listener
Listen to Symbol events
Symbol, Block
Listen to Symbol events on Array elements
Symbol, Array, Block

Listen arguments:
def listen( *args, &blok )
  if args[0].kind_of? Symbol
    if args.size == 2
      args[1].each { |match| @procs << [args[0], match, blok] }
    else
      add( [args[0], nil, blok] )
    end
  elsif args[0].kind_of? Array
    if args.size == 2
      args[0].each { |match| add( [nil, match, args[1]] ) }
    else
      args[0].each { |match| add( [ :start_element, match, blok ] ) }
    end
  else
    add([nil, nil, args[0]])
  end
end