Skip to content

Commit

Permalink
reenable nsmap for root element
Browse files Browse the repository at this point in the history
Makes it possible (again) to avoid the `kml:` prefix on every single tag
in the XML output.

Fixes: 84103d9 ("fix visibility and tests")
Fixes: 768a44c ("Refactor XML subelement handling in KML class")
  • Loading branch information
liskin committed Dec 22, 2023
1 parent 1d17e0f commit 51e21d0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fastkml/kml.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,12 @@ def etree_element(
root = config.etree.Element(f"{self.ns}kml") # type: ignore[attr-defined]
root.set("xmlns", config.KMLNS[1:-1])
else:
try:
if hasattr(config.etree, "LXML_VERSION"):
root = config.etree.Element( # type: ignore[attr-defined]
f"{self.ns}kml",
nsmap={None: self.ns[1:-1]},
)
except TypeError:
else:
root = config.etree.Element( # type: ignore[attr-defined]
f"{self.ns}kml",
)
Expand Down

0 comments on commit 51e21d0

Please sign in to comment.