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

◆ GetPrefixOfNamespaceStrict()

string System.Xml.XmlNode.GetPrefixOfNamespaceStrict ( string namespaceURI)
inlinepackageinherited

Definition at line 1134 of file XmlNode.cs.

1135 {
1136 XmlDocument document = Document;
1137 if (document != null)
1138 {
1140 XmlNode xmlNode = this;
1141 while (xmlNode != null)
1142 {
1143 if (xmlNode.NodeType == XmlNodeType.Element)
1144 {
1145 XmlElement xmlElement = (XmlElement)xmlNode;
1146 if (xmlElement.HasAttributes)
1147 {
1148 XmlAttributeCollection attributes = xmlElement.Attributes;
1149 for (int i = 0; i < attributes.Count; i++)
1150 {
1151 XmlAttribute xmlAttribute = attributes[i];
1152 if (xmlAttribute.Prefix.Length == 0)
1153 {
1154 if (Ref.Equal(xmlAttribute.LocalName, document.strXmlns) && xmlAttribute.Value == namespaceURI)
1155 {
1156 return string.Empty;
1157 }
1158 }
1159 else if (Ref.Equal(xmlAttribute.Prefix, document.strXmlns))
1160 {
1161 if (xmlAttribute.Value == namespaceURI)
1162 {
1163 return xmlAttribute.LocalName;
1164 }
1165 }
1166 else if (Ref.Equal(xmlAttribute.NamespaceURI, namespaceURI))
1167 {
1168 return xmlAttribute.Prefix;
1169 }
1170 }
1171 }
1172 if (Ref.Equal(xmlNode.NamespaceURI, namespaceURI))
1173 {
1174 return xmlNode.Prefix;
1175 }
1176 xmlNode = xmlNode.ParentNode;
1177 }
1178 else
1179 {
1180 xmlNode = ((xmlNode.NodeType != XmlNodeType.Attribute) ? xmlNode.ParentNode : ((XmlAttribute)xmlNode).OwnerElement);
1181 }
1182 }
1183 if (Ref.Equal(document.strReservedXml, namespaceURI))
1184 {
1185 return document.strXml;
1186 }
1187 if (Ref.Equal(document.strReservedXmlns, namespaceURI))
1188 {
1189 return document.strXmlns;
1190 }
1191 }
1192 return null;
1193 }
string Add(char[] array, int offset, int length)
XmlDocument Document
Definition XmlNode.cs:253

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

Referenced by System.Xml.XmlNode.GetPrefixOfNamespace(), and System.Xml.DocumentSchemaValidator.LookupPrefix().