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

◆ LookupPrefix()

string System.Xml.XmlNodeReaderNavigator.LookupPrefix ( string namespaceName)
inlinepackage

Definition at line 928 of file XmlNodeReaderNavigator.cs.

929 {
930 if (_bCreatedOnAttribute || namespaceName == null)
931 {
932 return null;
933 }
934 if (namespaceName == "http://www.w3.org/2000/xmlns/")
935 {
936 return _nameTable.Add("xmlns");
937 }
938 if (namespaceName == "http://www.w3.org/XML/1998/namespace")
939 {
940 return _nameTable.Add("xml");
941 }
942 if (namespaceName.Length == 0)
943 {
944 return string.Empty;
945 }
946 XmlNode xmlNode = _curNode;
947 while (xmlNode != null)
948 {
949 if (xmlNode.NodeType == XmlNodeType.Element)
950 {
951 XmlElement xmlElement = (XmlElement)xmlNode;
952 if (xmlElement.HasAttributes)
953 {
954 XmlAttributeCollection attributes = xmlElement.Attributes;
955 for (int i = 0; i < attributes.Count; i++)
956 {
957 XmlAttribute xmlAttribute = attributes[i];
958 if (!(xmlAttribute.Value == namespaceName))
959 {
960 continue;
961 }
962 if (xmlAttribute.Prefix.Length == 0 && xmlAttribute.LocalName == "xmlns")
963 {
964 if (LookupNamespace(string.Empty) == namespaceName)
965 {
966 return string.Empty;
967 }
968 }
969 else if (xmlAttribute.Prefix == "xmlns")
970 {
971 string localName = xmlAttribute.LocalName;
972 if (LookupNamespace(localName) == namespaceName)
973 {
974 return _nameTable.Add(localName);
975 }
976 }
977 }
978 }
979 }
980 else if (xmlNode.NodeType == XmlNodeType.Attribute)
981 {
982 xmlNode = ((XmlAttribute)xmlNode).OwnerElement;
983 continue;
984 }
985 xmlNode = xmlNode.ParentNode;
986 }
987 return null;
988 }
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.Xml.XmlAttributeCollection.Count, System.Xml.Dictionary, and System.Xml.XmlNodeReaderNavigator.LookupNamespace().

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