From cee446dbea2957ed0ddd334a1df6eb1c72c6e691 Mon Sep 17 00:00:00 2001 From: hellodword <46193371+hellodword@users.noreply.github.com> Date: Mon, 6 May 2024 12:47:44 +0000 Subject: [PATCH] Fix crash when printing Namespaces --- dom/node_namespace.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dom/node_namespace.go b/dom/node_namespace.go index 4f9595a..d41eb71 100644 --- a/dom/node_namespace.go +++ b/dom/node_namespace.go @@ -19,3 +19,12 @@ func (n *Namespace) Free() { clib.XMLNamespaceFree(n) n.ptr = 0 } + +// String returns the stringified Namespace +func (n *Namespace) String() string { + prefix := n.Prefix() + if prefix != "" { + prefix = ":" + prefix + } + return "xmlns" + prefix + `="` + n.URI() + `"` +}