From fc21993c045b3ab3a19026c4dd0fa47095e6e769 Mon Sep 17 00:00:00 2001 From: Jeremy Wright Date: Thu, 14 Nov 2024 08:06:14 -0700 Subject: [PATCH] fix: Improper namespace application in elementToBytes --- service_provider.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/service_provider.go b/service_provider.go index 30b35670..fa75f706 100644 --- a/service_provider.go +++ b/service_provider.go @@ -1672,7 +1672,11 @@ func elementToBytes(el *etree.Element) ([]byte, error) { doc := etree.NewDocument() doc.SetRoot(el.Copy()) for space, uri := range namespaces { - doc.Root().CreateAttr("xmlns:"+space, uri) + if space == "" { + doc.Root().CreateAttr("xmlns", uri) + } else { + doc.Root().CreateAttr("xmlns:"+space, uri) + } } return doc.WriteToBytes()