def add_root_attributes(self, root, tree, infile):
root.attrib['id'] = os.path.splitext(os.path.basename(infile))[0]
root.attrib['lang'] = self.language.lower()
date_string = re.match(
r'^(.+?,? \d.+?) - (.+)$',
tree.xpath('//td[@class="doc_title" and @align="left" and @valign="top"]')[0].text)
date = dateparser.parse(date_string.group(1)).date()
place = date_string.group(2)
root.attrib['date'] = str(date)
root.attrib['place'] = place
root.attrib['edition'] = tree.xpath('//td[@class="doc_title" and @align="right" and @valign="top"]')[0].text
pass
评论列表
文章目录