本文整理匯總了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()