# File lib/openurl/context_object.rb, line 203
    def import_xml(xml)                 
      if xml.is_a?(String)
        doc = REXML::Document.new xml.gsub(/>\n\s*</, '><').strip
      elsif xml.is_a?(REXML::Document)
        doc = xml
      else
        raise ArgumentError, "Argument must be an REXML::Document or well-formed XML string"
      end
      # Cut to the context object
                        ctx = REXML::XPath.first(doc, ".//ctx:context-object", {"ctx"=>"info:ofi/fmt:xml:xsd:ctx"})
                        ctx.attributes.each do |attr, val|                           
                                @admin.each do |adm, vals|
                                        self.set_administration_key(adm, val) if vals["label"] == attr                                                                                     
                                end
                        end
                        ctx.to_a.each do | ent |
                                if @@defined_entities.value?(ent.name())
                                        var = @@defined_entities.keys[@@defined_entities.values.index(ent.name())]
                                        meth = "import_#{var}_node"
                                        self.send(meth, ent)
                                else
                                        self.import_custom_node(ent)
                                end
                        end
    end