def _normalize_article_dir_with_dtd(self, path):
if exists(join(path, '<STR_LIT>')):<EOL><INDENT>return<EOL><DEDENT>main_xml_content = open(join(path, '<STR_LIT>')).read()<EOL>arts = ['<STR_LIT>','<STR_LIT>','<STR_LIT>','<STR_LIT>']<EOL>tmp_extracted = <NUM_LIT:0><EOL>for art in arts:<EOL><INDENT>if art in main_xml_content:<EOL><INDENT>self._extract_correct_dtd_package(art.split('<STR_LIT:.>')[<NUM_LIT:0>], path)<EOL>tmp_extracted = <NUM_LIT:1><EOL><DEDENT><DEDENT>if not tmp_extracted:<EOL><INDENT>message = "<STR_LIT>" + path<EOL>message += "<STR_LIT>"<EOL>self.logger.error(message)<EOL>raise ValueError(message)<EOL><DEDENT>command = ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>join(path, '<STR_LIT>'),<EOL>"<STR_LIT>", join(path, '<STR_LIT>')]<EOL>dummy, dummy, cmd_err = run_shell_command(command)<EOL>if cmd_err:<EOL><INDENT>message = "<STR_LIT>" % (<EOL>join(path, '<STR_LIT>'), cmd_err)<EOL>self.logger.error(message)<EOL>raise ValueError(message)<EOL><DEDENT>
main.xml from Elsevier assume the existence of a local DTD.
This procedure install the DTDs next to the main.xml file
and normalize it using xmllint in order to resolve all namespaces
and references.