xmlmask now ignores namespace on subdomains properly if ignore_ns is set
This commit is contained in:
parent
d9b812a73b
commit
a280e3c140
@ -41,6 +41,18 @@ class MatchXMLMask(base.MatcherBase):
|
|||||||
return False
|
return False
|
||||||
#for subelement in maskobj.getiterator()[1:]: #recursively compare subelements
|
#for subelement in maskobj.getiterator()[1:]: #recursively compare subelements
|
||||||
for subelement in maskobj: #recursively compare subelements
|
for subelement in maskobj: #recursively compare subelements
|
||||||
if not self.maskcmp(source.find(subelement.tag), subelement, use_ns):
|
if use_ns:
|
||||||
return False
|
if not self.maskcmp(source.find(subelement.tag), subelement, use_ns):
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
if not self.maskcmp(self.getChildIgnoreNS(source, subelement.tag), subelement, use_ns):
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def getChildIgnoreNS(self, xml, tag):
|
||||||
|
tag = tag.split('}')[-1]
|
||||||
|
try:
|
||||||
|
idx = [c.tag.split('}')[-1] for c in xml.getchildren()].index(tag)
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
|
return xml.getchildren()[idx]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user