From eb79d44ec9e0233476042990b6831d25ebf7bde8 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Sat, 11 Nov 2023 18:34:01 +0000 Subject: [PATCH] Add support for custom name spaces in _XMLObject constructor and fix namespace in MultiTrack #77 #22 --- fastkml/base.py | 2 ++ fastkml/gx.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fastkml/base.py b/fastkml/base.py index 64e78887..197f4a98 100644 --- a/fastkml/base.py +++ b/fastkml/base.py @@ -143,6 +143,8 @@ def _get_kwargs( strict: bool, ) -> Dict[str, Any]: """Returns a dictionary of kwargs for the class constructor.""" + name_spaces = name_spaces or {} + name_spaces = {**config.NAME_SPACES, **name_spaces} kwargs: Dict[str, Any] = {"ns": ns, "name_spaces": name_spaces} return kwargs diff --git a/fastkml/gx.py b/fastkml/gx.py index 5a81c8b7..b40a07b4 100644 --- a/fastkml/gx.py +++ b/fastkml/gx.py @@ -448,7 +448,7 @@ def _get_kwargs( strict=strict, ) kwargs["tracks"] = cls._get_track_kwargs_from_element( - ns=config.GXNS, + ns=kwargs["name_spaces"].get("gx", ""), element=element, strict=strict, )