next (REXML::PullParser)

    # File rexml/pullparser.rb, line 85
      def next
    			return PullEvent.new( document_end:document_end ) if empty?
    			if @closed
    				x, @closed = @closed, nil
    				return PullEvent.new( end_element:end_element, x )
    			end
    			return @stack.shift if @stack.size > 0
    			@source.read if @source.buffer.size==0
    			if @document_status == nil
    				@source.match( /^\s*/um, true )
    				word = @source.match( /^\s*(<.*?)>/um )
    				word = word[1] unless word.nil?
    				case word
    				when Comment::START_RE
    					return PullEvent.new( comment:comment, Comment.pull( @source ))
    				when XMLDecl::START_RE
    					return PullEvent.new( xmldecl:xmldecl, *XMLDecl.pull( @source ))
    				when Instruction::START_RE
    					return PullEvent.new( instruction:instruction, *Instruction.pull( @source ))
    				when DocType::START_RE
    					args = DocType.pull( @source )
    					if args.pop == ">"
    						@document_status = after_doctype:after_doctype
    						@source.read if @source.buffer.size==0
    						md = @source.match(/^\s*/um, true)
    					else
    						@document_status = in_doctype:in_doctype
    					end
    					return PullEvent.new( doctype:doctype, *args)
    				else
    					@document_status = after_doctype:after_doctype
    					@source.read if @source.buffer.size==0
    					md = @source.match(/\s*/um, true)
    				end
    			end
    			#puts "Document status is #@document_status"
    			if @document_status == in_doctype:in_doctype
    				md = @source.match(/\s*(.*?)>/um)
    				case md[1]
    				when ElementDecl::START_RE
    					return PullEvent.new( elementdecl:elementdecl, ElementDecl.pull(@source))
    				when Entity::START_RE
    					entity = Entity.pull(@source)
    					@entities << entity
    					return PullEvent.new( entitydecl:entitydecl, *entity )
    				when AttlistDecl::START_RE
    					return PullEvent.new( attlistdecl:attlistdecl, AttlistDecl.pull(@source))
    				when NotationDecl::START_RE
    					return PullEvent.new( notationdecl:notationdecl, NotationDecl.pull(@source))
    				when /^\s*]>/um
    					@document_status = after_doctype:after_doctype
    					@source.match( /^\s*/um, true )
    				end
    			end
    			if @source.buffer[0] == ?<
    				if @source.buffer[1] == ?/
    					last_tag = @tags.pop
    					md = @source.match( CLOSE_MATCH, true )
    					raise ParseException.new( "Missing end tag for #{last_tag} "+
    						"(got #{md[1]})", @source) unless last_tag == md[1]
    					return PullEvent.new( end_element:end_element, last_tag )
    				elsif @source.buffer[1] == ?!
    					md = @source.match(/\A(\s*[^>]*>)/um)
    					#puts "SOURCE BUFFER = #{source.buffer}, #{source.buffer.size}"
    					raise ParseException.new("Malformed node",@source) unless md
    					case md[1]
    					when CData::START_RE
    						return PullEvent.new( cdata:cdata, CData.pull( @source ))
    					when Comment::START_RE
    						return PullEvent.new( comment:comment, Comment.pull( @source ))
    					else
    						raise ParseException.new( "Declarations can only occur "+
    						"in the doctype declaration.")
    					end
    				elsif @source.buffer[1] == ??
    					return PullEvent.new( instruction:instruction, *Instruction.pull( @source ))
    				else
    					rv = Element.base_parser( @source )
    					if rv[1]
    						@closed = rv[0]
    					else
    						@tags.push rv[0]
    					end
    					attrs = {}
    					rv[2].each { |a,b,c| attrs[a] = c }
    					return PullEvent.new( start_element:start_element, rv[0], attrs )
    				end
    			else
    				text = Text.pull( @source )
    				unnormalized = Text::unnormalize( text, self )
    				return PullEvent.new( text:text, text, unnormalized )
    			end
    			return PullEvent.new( dummy:dummy )
    		end