diff --git a/Htmt/Parser.cs b/Htmt/Parser.cs index 2f3a277..0a9a986 100644 --- a/Htmt/Parser.cs +++ b/Htmt/Parser.cs @@ -82,6 +82,7 @@ private void Parse() AddIdentifierToNodes(); RunAttributeParsers(); RemoveIdentifierFromNodes(); + RemoveXNamespace(); } /// @@ -321,4 +322,27 @@ private void RemoveIdentifierFromNodes() } } } + + /// + /// Removes the x namespace from the document. + /// + private void RemoveXNamespace() + { + if (Xml.DocumentElement == null) return; + + var nodesToProcess = new Queue(Xml.DocumentElement.ChildNodes.Cast()); + + while (nodesToProcess.Count > 0) + { + var node = nodesToProcess.Dequeue(); + if (node is not XmlElement element) continue; + + element.RemoveAttribute("xmlns:x"); + + foreach (XmlNode child in element.ChildNodes) + { + nodesToProcess.Enqueue(child); + } + } + } }