internal override void TrackNamespaceNode(
     [NotNull] XmlAttribute attr,
     [NotNull] SortedList nsListToRender,
     [NotNull] Hashtable nsLocallyDeclared)
 {
     nsLocallyDeclared.Add(Exml.GetNamespacePrefix(attr) ?? throw new InvalidOperationException(), attr);
 }
        private bool HasNonRedundantInclusivePrefix(XmlAttribute attr)
        {
            string namespacePrefix = Exml.GetNamespacePrefix(attr);

            if (m_inclusivePrefixSet.ContainsKey((object)namespacePrefix))
            {
                int depth;
                return(Exml.IsNonRedundantNamespaceDecl(attr, GetNearestRenderedNamespaceWithMatchingPrefix(namespacePrefix, out depth)));
            }
            return(false);
        }
        internal override void GetNamespacesToRender(
            [NotNull] XmlElement element,
            [NotNull] SortedList attrListToRender,
            [NotNull] SortedList nsListToRender,
            [NotNull] Hashtable nsLocallyDeclared)
        {
            object[] objArray = new object[nsLocallyDeclared.Count];
            nsLocallyDeclared.Values.CopyTo(objArray, 0);
            foreach (XmlAttribute a in objArray)
            {
                var namespacePrefix = Exml.GetNamespacePrefix(a);
                if (namespacePrefix == null)
                {
                    continue;
                }
                var withMatchingPrefix = GetNearestRenderedNamespaceWithMatchingPrefix(namespacePrefix, out _);
                if (!Exml.IsNonRedundantNamespaceDecl(a, withMatchingPrefix))
                {
                    continue;
                }

                nsLocallyDeclared.Remove(namespacePrefix);
                if (Exml.IsXmlNamespaceNode(a))
                {
                    attrListToRender.Add(a, null);
                }
                else
                {
                    nsListToRender.Add(a, null);
                }
            }
            for (int i = m_ancestorStack.Count - 1; i >= 0; --i)
            {
                var values = GetScopeAt(i)?.GetUnrendered()?.Values;
                if (values != null)
                {
                    foreach (XmlAttribute a in values)
                    {
                        if (a == null)
                        {
                            continue;
                        }
                        var prefix = Exml.GetNamespacePrefix(a);
                        if (prefix == null)
                        {
                            continue;
                        }

                        GetNamespaceToRender(prefix, attrListToRender, nsListToRender, nsLocallyDeclared);
                    }
                }
            }
        }
 internal override void TrackNamespaceNode(
     XmlAttribute attr,
     SortedList nsListToRender,
     Hashtable nsLocallyDeclared)
 {
     if (HasNonRedundantInclusivePrefix(attr))
     {
         nsListToRender.Add((object)attr, (object)null);
     }
     else
     {
         nsLocallyDeclared.Add((object)Exml.GetNamespacePrefix(attr), (object)attr);
     }
 }
예제 #5
0
 internal void AddUnrendered(XmlAttribute attr)
 {
     m_unrendered.Add((object)Exml.GetNamespacePrefix(attr), (object)attr);
 }