def _normalize_article_dir_with_dtd(self, path):
files = [filename for filename in listdir(path)<EOL>if "<STR_LIT>" in filename]<EOL>if not files:<EOL><INDENT>files = [filename for filename in listdir(path)<EOL>if "<STR_LIT>" in filename]<EOL><DEDENT>if exists(join(path, '<STR_LIT>')):<EOL><INDENT>return<EOL><DEDENT>if '<STR_LIT>' in open(join(path, files[<NUM_LIT:0>])).read():<EOL><INDENT>path_normalized = mkdtemp(prefix="<STR_LIT>",<EOL>dir=CFG_TMPSHAREDDIR)<EOL>ZipFile(CFG_SPRINGER_JATS_PATH).extractall(path_normalized)<EOL><DEDENT>elif '<STR_LIT>' in open(join(path, files[<NUM_LIT:0>])).read():<EOL><INDENT>path_normalized = mkdtemp(prefix="<STR_LIT>",<EOL>dir=CFG_TMPSHAREDDIR)<EOL>ZipFile(CFG_SPRINGER_AV24_PATH).extractall(path_normalized)<EOL><DEDENT>else:<EOL><INDENT>error_msg = ("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>self.logger.error(error_msg % path)<EOL>raise ValueError(error_msg % path)<EOL><DEDENT>print("<STR_LIT>" % (files[<NUM_LIT:0>],))<EOL>(cmd_exit_code,<EOL>cmd_out,<EOL>cmd_err) = run_shell_command(("<STR_LIT>"<EOL>"<STR_LIT>"),<EOL>(join(path, files[<NUM_LIT:0>]),<EOL>join(path_normalized,<EOL>'<STR_LIT>')))<EOL>if cmd_err:<EOL><INDENT>error_msg = "<STR_LIT>"<EOL>self.logger.error(error_msg % (join(path, '<STR_LIT>'), cmd_err))<EOL>raise ValueError(error_msg % (join(path, '<STR_LIT>'), cmd_err))<EOL><DEDENT>self.articles_normalized.append(path_normalized)<EOL>
TODO: main.xml from Springer 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.