def get_record(self, xml_file):
self.document = parse(xml_file)<EOL>if get_value_in_tag(self.document, "<STR_LIT>"):<EOL><INDENT>raise ApsPackageXMLError("<STR_LIT>"<EOL>% (xml_file,))<EOL><DEDENT>page_count = self._get_page_count()<EOL>rec = create_record()<EOL>if page_count:<EOL><INDENT>record_add_field(rec, '<STR_LIT>', subfields=[('<STR_LIT:a>', page_count)])<EOL><DEDENT>pacscodes = self._get_pacscodes()<EOL>for pacscode in pacscodes:<EOL><INDENT>record_add_field(rec, '<STR_LIT>', subfields=[('<STR_LIT:2>', '<STR_LIT>'),<EOL>('<STR_LIT:a>', pacscode)])<EOL><DEDENT>subject = self._get_subject()<EOL>if subject:<EOL><INDENT>record_add_field(rec, '<STR_LIT>', ind1='<STR_LIT:1>', ind2='<STR_LIT>', subfields=[('<STR_LIT:2>', '<STR_LIT>'),<EOL>('<STR_LIT:a>', subject)])<EOL><DEDENT>keywords = self._get_keywords()<EOL>if keywords:<EOL><INDENT>record_add_field(rec, '<STR_LIT>', ind1='<STR_LIT:1>', subfields=[('<STR_LIT:a>', '<STR_LIT:U+002CU+0020>'.join(keywords)),<EOL>('<STR_LIT>', '<STR_LIT>')])<EOL><DEDENT>title, subtitle, _ = self._get_title()<EOL>subfields = []<EOL>if subtitle:<EOL><INDENT>subfields.append(('<STR_LIT:b>', subtitle))<EOL><DEDENT>if title:<EOL><INDENT>subfields.append(('<STR_LIT:a>', title))<EOL>record_add_field(rec, '<STR_LIT>', subfields=subfields)<EOL><DEDENT>journal, volume, issue, year, start_date, doi,article_id, _, _ = self._get_publication_information()<EOL>if start_date:<EOL><INDENT>record_add_field(rec, '<STR_LIT>', subfields=[('<STR_LIT:c>', start_date),<EOL>('<STR_LIT:t>', '<STR_LIT>')])<EOL><DEDENT>if doi:<EOL><INDENT>record_add_field(rec, '<STR_LIT>', ind1='<STR_LIT>', subfields=[('<STR_LIT:a>', doi),<EOL>('<STR_LIT:2>', '<STR_LIT>')])<EOL><DEDENT>abstract = self._get_abstract()<EOL>if abstract:<EOL><INDENT>record_add_field(rec, '<STR_LIT>', subfields=[('<STR_LIT:a>', abstract),<EOL>('<STR_LIT>', '<STR_LIT>')])<EOL><DEDENT>license, license_type, license_url = self._get_license()<EOL>subfields = []<EOL>if license:<EOL><INDENT>subfields.append(('<STR_LIT:a>', license))<EOL><DEDENT>if license_url:<EOL><INDENT>subfields.append(('<STR_LIT:u>', license_url))<EOL><DEDENT>if subfields:<EOL><INDENT>record_add_field(rec, '<STR_LIT>', subfields=subfields)<EOL><DEDENT>c_holder, c_year, c_statement = self._get_copyright()<EOL>c_holder, c_year, c_statement = self._get_copyright()<EOL>if c_holder and c_year:<EOL><INDENT>record_add_field(rec, '<STR_LIT>', subfields=[('<STR_LIT:d>', c_holder),<EOL>('<STR_LIT:g>', c_year),<EOL>('<STR_LIT:e>', '<STR_LIT>')])<EOL><DEDENT>elif c_statement:<EOL><INDENT>record_add_field(rec, '<STR_LIT>', subfields=[('<STR_LIT:f>', c_statement),<EOL>('<STR_LIT:e>', '<STR_LIT>')])<EOL><DEDENT>record_add_field(rec, '<STR_LIT>', subfields=[('<STR_LIT:p>', journal),<EOL>('<STR_LIT:v>', volume),<EOL>('<STR_LIT:n>', issue),<EOL>('<STR_LIT:y>', year),<EOL>('<STR_LIT:c>', article_id)])<EOL>record_add_field(rec, '<STR_LIT>', subfields=[('<STR_LIT:a>', '<STR_LIT>')])<EOL>record_add_field(rec, '<STR_LIT>', subfields=[('<STR_LIT:a>', '<STR_LIT>')])<EOL>record_add_field(rec, '<STR_LIT>', subfields=[('<STR_LIT:a>', '<STR_LIT>')])<EOL>self._add_authors(rec)<EOL>self._add_references(rec)<EOL>try:<EOL><INDENT>return record_xml_output(rec)<EOL><DEDENT>except UnicodeDecodeError:<EOL><INDENT>sys.stderr.write("""<STR_LIT>""" + doi)<EOL>return "<STR_LIT>"<EOL><DEDENT>
Reads a xml file in JATS format and returns
            a xml string in marc format