private bool HasNonRedundantInclusivePrefix(XmlAttribute attr)
        {
            int    tmp;
            string nsPrefix = Utils.GetNamespacePrefix(attr);

            return(_inclusivePrefixSet.ContainsKey(nsPrefix) &&
                   Utils.IsNonRedundantNamespaceDecl(attr, GetNearestRenderedNamespaceWithMatchingPrefix(nsPrefix, out tmp)));
        }
 internal override void TrackNamespaceNode(XmlAttribute attr, SortedList nsListToRender, Hashtable nsLocallyDeclared)
 {
     if (!Utils.IsXmlPrefixDefinitionNode(attr))
     {
         if (HasNonRedundantInclusivePrefix(attr))
         {
             nsListToRender.Add(attr, null);
         }
         else
         {
             nsLocallyDeclared.Add(Utils.GetNamespacePrefix(attr), attr);
         }
     }
 }
コード例 #3
0
        internal override void GetNamespacesToRender(XmlElement element, SortedList attrListToRender, SortedList nsListToRender, Hashtable nsLocallyDeclared)
        {
            XmlAttribute attrib = null;

            object[] attrs = new object[nsLocallyDeclared.Count];
            nsLocallyDeclared.Values.CopyTo(attrs, 0);
            foreach (object a in attrs)
            {
                attrib = (XmlAttribute)a;
                int          rDepth;
                XmlAttribute rAncestral = GetNearestRenderedNamespaceWithMatchingPrefix(Utils.GetNamespacePrefix(attrib), out rDepth);
                if (Utils.IsNonRedundantNamespaceDecl(attrib, rAncestral))
                {
                    nsLocallyDeclared.Remove(Utils.GetNamespacePrefix(attrib));
                    if (Utils.IsXmlNamespaceNode(attrib))
                    {
                        attrListToRender.Add(attrib, null);
                    }
                    else
                    {
                        nsListToRender.Add(attrib, null);
                    }
                }
            }

            for (int i = _ancestorStack.Count - 1; i >= 0; i--)
            {
                foreach (object a in GetScopeAt(i).GetUnrendered().Values)
                {
                    attrib = (XmlAttribute)a;
                    if (attrib != null)
                    {
                        GetNamespaceToRender(Utils.GetNamespacePrefix(attrib), attrListToRender, nsListToRender, nsLocallyDeclared);
                    }
                }
            }
        }
 internal void AddUnrendered(XmlAttribute attr)
 {
     _unrendered.Add(Utils.GetNamespacePrefix(attr), attr);
 }
コード例 #5
0
 internal override void TrackXmlNamespaceNode(XmlAttribute attr, SortedList nsListToRender, SortedList attrListToRender, Hashtable nsLocallyDeclared)
 {
     nsLocallyDeclared.Add(Utils.GetNamespacePrefix(attr), attr);
 }