# File rexml/doctype.rb, line 150
    def DocType.parser source
      begin
	md = source.match(/\s*(.*?)>/um)
	until md[1].strip == "]" 
	  case md[1]
	  when /^%/ #/u
	    md = source.match(/^\s*%(.*?);/um, true)
	    yield md[1]
	  when AttlistDecl::START_RE
	    yield AttlistDecl
	  when ElementDecl::START_RE
	    yield ElementDecl
	  when EntityDecl::START_RE
	    yield EntityDecl
	  when NotationDecl::START_RE
	    yield NotationDecl
	  when Comment::START_RE
	    yield Comment
	  when Instruction::START_RE
	    yield Instruction
	  else
	    if md.nil?
	      raise "no match!"
	    else
	      raise "illegal entry \"#{md[1]}\" in DOCTYPE\n(match data was '#{md[0]}'"
	    end
	  end
	  md = source.match(/\s*(.*?)>/um)
	  raise ParseException.new( "Invalid end of DOCTYPE declaration \"#{source.buffer}\"", source ) if md.nil?
	end
	source.match(/\s*]\s*>/um, true)
      rescue ParseException
	raise
      rescue Exception => err
	raise
	raise ParseException.new( "Error parsing DOCTYPE declaration", source, nil, err )
      end
    end