本文整理汇总了Python中XML.findMatches方法的典型用法代码示例。如果您正苦于以下问题:Python XML.findMatches方法的具体用法?Python XML.findMatches怎么用?Python XML.findMatches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XML
的用法示例。
在下文中一共展示了XML.findMatches方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_findMatches_guaranteed_match
# 需要导入模块: import XML [as 别名]
# 或者: from XML import findMatches [as 别名]
def test_findMatches_guaranteed_match(self):
s = "<xml><THU><Team></Team></THU><THU></THU></xml>"
a = fromstring(s)
pattern = XML.getPattern(a)
patternChildren = 0
patternChildren = XML.countChildren(pattern)
XML.matches = 0
XML.findMatches(a, pattern, patternChildren)
self.assertTrue(XML.matches == 0)
示例2: test_findMatches
# 需要导入模块: import XML [as 别名]
# 或者: from XML import findMatches [as 别名]
def test_findMatches(self):
s = "<xml><THU><Team><ACRush></ACRush><Jelly></Jelly><Cooly></Cooly></Team><JiaJia><Team><Ahyangyi></Ahyangyi><Dragon></Dragon><Cooly><Amber></Amber></Cooly></Team></JiaJia></THU><Team><Cooly></Cooly></Team></xml>"
a = fromstring(s)
pattern = XML.getPattern(a)
patternChildren = 0
patternChildren = XML.countChildren(pattern)
XML.locations = []
XML.locations = XML.findMatches(a, pattern, patternChildren)
self.assertTrue(XML.locations == []) #function only works in conjunction with the count function