1 require 'rexml/parsers/streamparser'
2 require 'rexml/parsers/baseparser'
3 require 'rexml/light/node'
10 @parser = REXML::Parsers::BaseParser.new( stream )
13 def add_listener( listener )
14 @parser.add_listener( listener )
19 @parser.stream = @stream
23 root = context = [ :document ]
31 when :start_element, :start_doctype
34 new_node[1,0] = [context]
36 when :end_element, :end_doctype
41 new_node[1,0] = [context]
48 # An element is an array. The array contains:
49 # 0 The parent element
51 # 2 A hash of attributes
52 # 3..-1 The child elements
53 # An element is an array of size > 3
55 # PIs are [ :processing_instruction, target, data ]
56 # Comments are [ :comment, data ]
57 # DocTypes are DocType structs
58 # The root is an array with XMLDecls, Text, DocType, Array, Text