本文整理汇总了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()