def record_xml(rec, as_doc: false)
      doc = Nokogiri.XML(rec._source.to_s)
      doc.root
        .add_namespace_definition(nil, 'http://www.openarchives.org/OAI/2.0/')
      as_doc ? doc : doc.to_xml
    end
def record_xml(rec, as_doc: false)
      doc = Nokogiri.XML(rec._source.to_s)
      doc.root
        .add_namespace_definition(nil, 'http://www.openarchives.org/OAI/2.0/')
      as_doc ? doc : doc.to_xml
    end
Transforms an OAI::Record to xml suitable for saving with the
 OriginalRecord. It's necessary to build a new document and add the
 namespace manually to normalize record output between `ListRecords` and
 `GetRecord` requests.

 @param rec [OAI::Record]
 @return [String] an xml string