Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetNamespaceManager()

static XmlNamespaceManager System.Xml.DocumentXPathNavigator.GetNamespaceManager ( XmlNode node,
XmlDocument document )
inlinestaticprivate

Definition at line 1613 of file DocumentXPathNavigator.cs.

1614 {
1615 XmlNamespaceManager xmlNamespaceManager = new XmlNamespaceManager(document.NameTable);
1617 while (node != null)
1618 {
1619 if (node is XmlElement { HasAttributes: not false } xmlElement)
1620 {
1621 list.Add(xmlElement);
1622 }
1623 node = node.ParentNode;
1624 }
1625 for (int num = list.Count - 1; num >= 0; num--)
1626 {
1627 xmlNamespaceManager.PushScope();
1628 XmlAttributeCollection attributes = list[num].Attributes;
1629 for (int i = 0; i < attributes.Count; i++)
1630 {
1631 XmlAttribute xmlAttribute = attributes[i];
1632 if (xmlAttribute.IsNamespace)
1633 {
1634 string prefix = ((xmlAttribute.Prefix.Length == 0) ? string.Empty : xmlAttribute.LocalName);
1635 xmlNamespaceManager.AddNamespace(prefix, xmlAttribute.Value);
1636 }
1637 }
1638 }
1639 return xmlNamespaceManager;
1640 }

References System.Xml.XmlAttributeCollection.Count, System.Xml.Dictionary, System.Xml.DocumentXPathNavigator.HasAttributes, System.list, and System.prefix.

Referenced by System.Xml.DocumentXPathNavigator.AppendChild(), System.Xml.DocumentXPathNavigator.CreateAttributes(), System.Xml.DocumentXPathNavigator.InsertAfter(), System.Xml.DocumentXPathNavigator.InsertBefore(), System.Xml.DocumentXPathNavigator.PrependChild(), and System.Xml.DocumentXPathNavigator.ReplaceRange().