(
cls, node, tag=None, attr=None, value=None, childs=False)
| 108 | |
| 109 | @classmethod |
| 110 | def getElementsByTag( |
| 111 | cls, node, tag=None, attr=None, value=None, childs=False): |
| 112 | NS = "http://exslt.org/regular-expressions" |
| 113 | # selector = tag or '*' |
| 114 | selector = 'descendant-or-self::%s' % (tag or '*') |
| 115 | if attr and value: |
| 116 | selector = '%s[re:test(@%s, "%s", "i")]' % (selector, attr, value) |
| 117 | elems = node.xpath(selector, namespaces={"re": NS}) |
| 118 | # remove the root node |
| 119 | # if we have a selection tag |
| 120 | if node in elems and (tag or childs): |
| 121 | elems.remove(node) |
| 122 | return elems |
| 123 | |
| 124 | @classmethod |
| 125 | def appendChild(cls, node, child): |
no test coverage detected