本文整理汇总了Python中nlmmanipulate.NlmManipulate.return_elements方法的典型用法代码示例。如果您正苦于以下问题:Python NlmManipulate.return_elements方法的具体用法?Python NlmManipulate.return_elements怎么用?Python NlmManipulate.return_elements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nlmmanipulate.NlmManipulate
的用法示例。
在下文中一共展示了NlmManipulate.return_elements方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: scan
# 需要导入模块: from nlmmanipulate import NlmManipulate [as 别名]
# 或者: from nlmmanipulate.NlmManipulate import return_elements [as 别名]
def scan(self):
self.gv.nlm_file_path = self.gv.settings.args['<input>']
handle, self.gv.nlm_temp_path = tempfile.mkstemp()
os.close(handle)
manipulate = NlmManipulate(self.gv)
# open the database
self.debug.print_debug(self, u'Opening database: {0}'.format(self.gv.database_file_path))
db = shelve.open(self.gv.database_file_path)
# we /could/ use objectify, which would be cleaner, but it doesn't allow such rigidity of parsing
# scan for journal items
tree = manipulate.return_elements('//element-citation[@publication-type="journal"]')
self.store_journal_item(db, tree)
tree = manipulate.return_elements('//element-citation[@publication-type="book"]')
self.store_book(db, tree)
tree = manipulate.return_elements('//element-citation[@publication-type="bookchapter"]')
self.store_book_chapter(db, tree)
db.close()