From a1c5441e1daa43d45b8029276bbd21d6ea260259 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Thu, 16 Feb 2017 22:35:56 +1300 Subject: [PATCH] -Refactor --- .../Converters/XmlNodeConverter.cs | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs b/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs index 89f8da61..e494ac3d 100644 --- a/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs +++ b/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs @@ -2232,34 +2232,17 @@ namespace Newtonsoft.Json.Converters { foreach (IXmlNode xmlNode in c) { -#if HAVE_XML_DOCUMENT - // ignores the attribute if it is the declaration of namespace "JsonNamespaceUri" - var xmlAttribute = xmlNode.WrappedNode as XmlAttribute; - - if (xmlAttribute != null && - xmlAttribute.Prefix.Equals("xmlns", StringComparison.OrdinalIgnoreCase) && - xmlAttribute.Value == JsonNamespaceUri) + if (xmlNode.NamespaceUri == JsonNamespaceUri) { continue; } -#endif -#if HAVE_XLINQ - // ignores the attribute if it is the declaration of namespace "JsonNamespaceUri" - var xAttribute = xmlNode.WrappedNode as XAttribute; - - if (xAttribute != null && - xAttribute.IsNamespaceDeclaration && - xAttribute.Value == JsonNamespaceUri) + if (xmlNode.NamespaceUri == "http://www.w3.org/2000/xmlns/" && xmlNode.Value == JsonNamespaceUri) { continue; } -#endif - if (xmlNode.NamespaceUri != JsonNamespaceUri) - { - return true; - } + return true; } return false;