diff --git a/sat/tools/xml_tools.py b/sat/tools/xml_tools.py index 04797ccf..b71d8a53 100644 --- a/sat/tools/xml_tools.py +++ b/sat/tools/xml_tools.py @@ -1818,22 +1818,22 @@ def findAll(elt, namespaces=None, names=None): yield found -def pFmtElt(elt, indent=0): +def pFmtElt(elt, indent=0, defaultUri=""): """Pretty format a domish.Element""" strings = [] for child in elt.children: if domish.IElement.providedBy(child): - strings.append(pFmtElt(child, indent+2)) + strings.append(pFmtElt(child, indent+2, defaultUri=elt.defaultUri)) else: strings.append(f"{(indent+2)*' '}{child!s}") if elt.children: nochild_elt = domish.Element( - (elt.uri, elt.name), elt.defaultUri, elt.attribs, elt.localPrefixes + (elt.uri, elt.name), elt.defaultUri, elt.attributes, elt.localPrefixes ) - strings.insert(0, f"{indent*' '}{nochild_elt.toXml()[:-2]}>") + strings.insert(0, f"{indent*' '}{nochild_elt.toXml(defaultUri=defaultUri)[:-2]}>") strings.append(f"{indent*' '}") else: - strings.append(f"{indent*' '}{elt.toXml()}") + strings.append(f"{indent*' '}{elt.toXml(defaultUri=defaultUri)}") return '\n'.join(strings)