Skip to content
Snippets Groups Projects

XML Converter

Merged Alexander Schlemmer requested to merge f-xml-converter into dev
All threads resolved!
Compare and Show latest version
2 files
+ 18
9
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -75,7 +75,15 @@ class XMLTagConverter(Converter):
if not isinstance(element, XMLTagElement):
raise TypeError("Element must be an instance of XMLTagElement.")
nsmap = self.definition["nsmap"]
# Get the namespace map from the element:
nsmap = element.tag.nsmap
# The default name of the default namespace is "default".
# You can overwrite it using the attribute "default_namespace" in the converter definition:
default_namespace = self.definition.get("default_namespace", "default")
if None in nsmap:
nsmap[default_namespace] = nsmap[None]
del nsmap[None]
xpath = self.definition.get("xpath", "child::*")
children = element.tag.xpath(xpath, namespaces=nsmap)
el_lst = []
Loading