# File lib/openurl/context_object_entity.rb, line 64
    def xml(co_elem)      
      meta = {"container"=>co_elem.add_element("ctx:"+@label)}

      if @metadata.length > 0 or @format
        meta["metadata-by-val"] = meta["container"].add_element("ctx:metadata-by-val")
        if @format 
          meta["format"] = meta["container"].add_element("ctx:format")
          meta["format"].text = "info:ofi/fmt:xml:xsd:"+@format
        end
        if @metadata.length > 0
          meta["metadata"] = meta["metadata-by-val"].add_element("ctx:metadata")
          @metadata.each do |k,v|
            meta[k] = meta["metadata"].add_element("ctx:"+k)
            meta[k].text = v
          end
        end
      end
      if @reference["format"] 
        meta["metadata-by-ref"] = meta["container"].add_element("ctx:metadata-by-ref")
        meta["ref_format"] = meta["metadata-by-ref"].add_element("ctx:format")
        meta["ref_format"].text = @reference["format"]
        meta["ref_loc"] = meta["metadata-by-ref"].add_element("ctx:location")
        meta["ref_loc"].text = @reference["location"]          
      end
      
      @identifiers.each do |id|
        # Yes, meta["identifier"] will get over-written if there's more than
        # one identifier. But I dont' think this meta hash is used for much
        # I don't think it's a problem. -JR 
        meta["identifier"] = meta["container"].add_element("ctx:identifier")
        meta["identifier"].text = id
      end
      if @private_data
        meta["private-data"] = meta["container"].add_element("ctx:private-data")
        meta["private-data"].text = @private_data
      end          
      return co_elem
    end