Ejemplo n.º 1
0
 def _classes(self):
     main = self.xml.classification_national.contents_of('main_classification')
     further = self.xml.classification_national.contents_of('further_classification')
     it = [main[0] if xml_util.has_content(main) else []]
     if xml_util.has_content(further):
         it.extend(further)
     return [ [x[:3].replace(' ',''), x[3:].replace(' ','')] for x in it]
Ejemplo n.º 2
0
 def _cit_list(self):
     res = []
     citations = self.xml.references_cited.citation
     for citation in citations:
         cit_data = citation.contents_of('category')
         if citation.patcit:
             for tag in ['country','doc_number','date','kind','name']:
                 contents = citation.contents_of(tag)
                 if isinstance(contents, list) and contents:
                     cit_data.append(contents[0])
                 else:
                     cit_data.append(contents if xml_util.has_content(contents) else '')
             cit_data.append('')
         if citation.othercit:
             contents = citation.contents_of('othercit')
             for chunk in contents:
                 cit_data.extend(['','','','',''])
                 if isinstance(chunk,list):
                     cit_data.append(''.join([xml_util.escape_html_nosub(x) for x in chunk]).upper())
                 else:
                     cit_data.append(xml_util.escape_html_nosub(chunk))
         res.append(cit_data)
     return res