%title%

    # File /home/ser/Work/rexml/rexml/document.rb, line 150
      def Document.parse_stream( source, listener )
    			if			source.kind_of? Source
    				# do nothing
    			elsif		source.kind_of?  IO
    				source = IOSource.new(source)
    			elsif		source.kind_of? String
    				source = Source.new source
    			else
    				raise "Unknown source type!"
    			end

    			while not source.empty?
    				source.match( /^\*/um, true )
    				word = source.match( /^\*(<.*?)>/um )
    				word = word[1] unless word.nil?
    				case word
    				when nil
    					word = source.match( /\*()/um, true )
    					return if word.nil?
    					raise "data found outside of root element ('#{nw}')" if nw.strip.length > 0
    				when Comment::START_RE
    					Comment.parse_stream source, listener
    				when DocType::START_RE
    					DocType.parse_stream source, listener
    				when XMLDecl::START_RE
    					XMLDecl.parse_stream source, listener
    				when Instruction::START_RE
    					Instruction.parse_stream source, listener
    				else
    					Element.parse_stream source, listener
    				end
    			end
    			# Here we need to check for invalid documents.
    		end