本文整理匯總了Python中robot.utils.ET.iterparse方法的典型用法代碼示例。如果您正苦於以下問題:Python ET.iterparse方法的具體用法?Python ET.iterparse怎麽用?Python ET.iterparse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類robot.utils.ET
的用法示例。
在下文中一共展示了ET.iterparse方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: build
# 需要導入模塊: from robot.utils import ET [as 別名]
# 或者: from robot.utils.ET import iterparse [as 別名]
def build(self, result):
handler = XmlElementHandler(result)
# Faster attribute lookup inside for loop
start, end = handler.start, handler.end
with self._source as source:
for event, elem in ET.iterparse(source, events=('start', 'end')):
start(elem) if event == 'start' else end(elem)
SuiteTeardownFailureHandler(result.generator).visit_suite(result.suite)
return result
示例2: _parse
# 需要導入模塊: from robot.utils import ET [as 別名]
# 或者: from robot.utils.ET import iterparse [as 別名]
def _parse(self, source, start, end):
context = ET.iterparse(source, events=('start', 'end'))
if not self._include_keywords:
context = self._omit_keywords(context)
for event, elem in context:
if event == 'start':
start(elem)
else:
end(elem)
elem.clear()
示例3: _parse
# 需要導入模塊: from robot.utils import ET [as 別名]
# 或者: from robot.utils.ET import iterparse [as 別名]
def _parse(self, source, start, end):
context = ET.iterparse(source, events=("start", "end"))
if not self._include_keywords:
context = self._omit_keywords(context)
elif self._flattened_keywords:
context = self._flatten_keywords(context, self._flattened_keywords)
for event, elem in context:
if event == "start":
start(elem)
else:
end(elem)
elem.clear()