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

◆ GetNamespacesInScope()

IDictionary< string, string > System.Xml.XmlNodeReaderNavigator.GetNamespacesInScope ( XmlNamespaceScope scope)
inlinepackage

Definition at line 990 of file XmlNodeReaderNavigator.cs.

991 {
994 {
995 return dictionary;
996 }
997 XmlNode xmlNode = _curNode;
998 while (xmlNode != null)
999 {
1000 if (xmlNode.NodeType == XmlNodeType.Element)
1001 {
1002 XmlElement xmlElement = (XmlElement)xmlNode;
1003 if (xmlElement.HasAttributes)
1004 {
1005 XmlAttributeCollection attributes = xmlElement.Attributes;
1006 for (int i = 0; i < attributes.Count; i++)
1007 {
1008 XmlAttribute xmlAttribute = attributes[i];
1009 if (xmlAttribute.LocalName == "xmlns" && xmlAttribute.Prefix.Length == 0)
1010 {
1011 if (!dictionary.ContainsKey(string.Empty))
1012 {
1013 dictionary.Add(_nameTable.Add(string.Empty), _nameTable.Add(xmlAttribute.Value));
1014 }
1015 }
1016 else if (xmlAttribute.Prefix == "xmlns")
1017 {
1018 string localName = xmlAttribute.LocalName;
1019 if (!dictionary.ContainsKey(localName))
1020 {
1022 }
1023 }
1024 }
1025 }
1026 if (scope == XmlNamespaceScope.Local)
1027 {
1028 break;
1029 }
1030 }
1031 else if (xmlNode.NodeType == XmlNodeType.Attribute)
1032 {
1033 xmlNode = ((XmlAttribute)xmlNode).OwnerElement;
1034 continue;
1035 }
1036 xmlNode = xmlNode.ParentNode;
1037 }
1038 if (scope != XmlNamespaceScope.Local)
1039 {
1040 if (dictionary.ContainsKey(string.Empty) && dictionary[string.Empty] == string.Empty)
1041 {
1042 dictionary.Remove(string.Empty);
1043 }
1044 if (scope == XmlNamespaceScope.All)
1045 {
1046 dictionary.Add(_nameTable.Add("xml"), _nameTable.Add("http://www.w3.org/XML/1998/namespace"));
1047 }
1048 }
1049 return dictionary;
1050 }
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
string Add(char[] array, int offset, int length)

References System.Xml.XmlNodeReaderNavigator._bCreatedOnAttribute, System.Xml.XmlNodeReaderNavigator._curNode, System.Xml.XmlNodeReaderNavigator._nameTable, System.Xml.XmlNameTable.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Xml.XmlAttributeCollection.Count, System.dictionary, and System.Collections.Generic.Dictionary< TKey, TValue >.Remove().

Referenced by System.Xml.XmlNodeReader.GetNamespacesInScope().