-Refactor
This commit is contained in:
@@ -2232,34 +2232,17 @@ namespace Newtonsoft.Json.Converters
|
|||||||
{
|
{
|
||||||
foreach (IXmlNode xmlNode in c)
|
foreach (IXmlNode xmlNode in c)
|
||||||
{
|
{
|
||||||
#if HAVE_XML_DOCUMENT
|
if (xmlNode.NamespaceUri == JsonNamespaceUri)
|
||||||
// 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)
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAVE_XLINQ
|
if (xmlNode.NamespaceUri == "http://www.w3.org/2000/xmlns/" && xmlNode.Value == JsonNamespaceUri)
|
||||||
// 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)
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (xmlNode.NamespaceUri != JsonNamespaceUri)
|
return true;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user