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

◆ GetNamespaceOfPrefixStrict()

string System.Xml.XmlNode.GetNamespaceOfPrefixStrict ( string prefix)
inlinepackageinherited

Definition at line 1051 of file XmlNode.cs.

1052 {
1053 XmlDocument document = Document;
1054 string array = prefix;
1055 if (document != null)
1056 {
1058 if (array == null)
1059 {
1060 return null;
1061 }
1062 XmlNode xmlNode = this;
1063 while (xmlNode != null)
1064 {
1065 if (xmlNode.NodeType == XmlNodeType.Element)
1066 {
1067 XmlElement xmlElement = (XmlElement)xmlNode;
1068 if (xmlElement.HasAttributes)
1069 {
1070 XmlAttributeCollection attributes = xmlElement.Attributes;
1071 if (array.Length == 0)
1072 {
1073 for (int i = 0; i < attributes.Count; i++)
1074 {
1075 XmlAttribute xmlAttribute = attributes[i];
1076 if (xmlAttribute.Prefix.Length == 0 && Ref.Equal(xmlAttribute.LocalName, document.strXmlns))
1077 {
1078 return xmlAttribute.Value;
1079 }
1080 }
1081 }
1082 else
1083 {
1084 for (int j = 0; j < attributes.Count; j++)
1085 {
1086 XmlAttribute xmlAttribute2 = attributes[j];
1087 if (Ref.Equal(xmlAttribute2.Prefix, document.strXmlns))
1088 {
1089 if (Ref.Equal(xmlAttribute2.LocalName, array))
1090 {
1091 return xmlAttribute2.Value;
1092 }
1093 }
1094 else if (Ref.Equal(xmlAttribute2.Prefix, array))
1095 {
1096 return xmlAttribute2.NamespaceURI;
1097 }
1098 }
1099 }
1100 }
1101 if (Ref.Equal(xmlNode.Prefix, array))
1102 {
1103 return xmlNode.NamespaceURI;
1104 }
1105 xmlNode = xmlNode.ParentNode;
1106 }
1107 else
1108 {
1109 xmlNode = ((xmlNode.NodeType != XmlNodeType.Attribute) ? xmlNode.ParentNode : ((XmlAttribute)xmlNode).OwnerElement);
1110 }
1111 }
1112 if (Ref.Equal(document.strXml, array))
1113 {
1114 return document.strReservedXml;
1115 }
1116 if (Ref.Equal(document.strXmlns, array))
1117 {
1118 return document.strReservedXmlns;
1119 }
1120 }
1121 return null;
1122 }
string? Get(char[] array, int offset, int length)
XmlDocument Document
Definition XmlNode.cs:253

References System.array, System.Xml.XmlAttributeCollection.Count, System.Xml.Dictionary, System.Xml.XmlNode.Document, System.Xml.Ref.Equal(), System.Xml.XmlNameTable.Get(), System.Xml.XmlDocument.NameTable, and System.prefix.

Referenced by System.Xml.XmlNode.GetNamespaceOfPrefix(), and System.Xml.DocumentSchemaValidator.LookupNamespace().