# File lib/rbrainz/webservice/mbxml.rb, line 37
      def initialize(stream, factory=nil)
        begin
          @document = REXML::Document.new(stream)
        rescue REXML::ParseException => e
          raise ParseError, e.to_s
        end
        
        # Set the model factory
        factory = Model::DefaultFactory.new unless factory
        @factory = factory
        
        # Already loaded artists, releases, tracks and labels will get cached
        # in these variables to link to them if they occure multiple times
        # inside the same document.
        @artists        = Hash.new
        @release_groups = Hash.new
        @releases       = Hash.new
        @tracks         = Hash.new
        @labels         = Hash.new
      end