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

◆ GetPrefixOfNamespace()

string? System.Xml.Linq.XElement.GetPrefixOfNamespace ( XNamespace ns)
inline

Definition at line 305 of file XElement.cs.

306 {
307 if (ns == null)
308 {
309 throw new ArgumentNullException("ns");
310 }
311 string namespaceName = ns.NamespaceName;
312 bool flag = false;
313 XElement xElement = this;
314 do
315 {
316 XAttribute xAttribute = xElement.lastAttr;
317 if (xAttribute != null)
318 {
319 bool flag2 = false;
320 do
321 {
322 xAttribute = xAttribute.next;
323 if (xAttribute.IsNamespaceDeclaration)
324 {
325 if (xAttribute.Value == namespaceName && xAttribute.Name.NamespaceName.Length != 0 && (!flag || GetNamespaceOfPrefixInScope(xAttribute.Name.LocalName, xElement) == null))
326 {
327 return xAttribute.Name.LocalName;
328 }
329 flag2 = true;
330 }
331 }
332 while (xAttribute != xElement.lastAttr);
333 flag = flag || flag2;
334 }
336 }
337 while (xElement != null);
338 if ((object)namespaceName == "http://www.w3.org/XML/1998/namespace")
339 {
340 if (!flag || GetNamespaceOfPrefixInScope("xml", null) == null)
341 {
342 return "xml";
343 }
344 }
345 else if ((object)namespaceName == "http://www.w3.org/2000/xmlns/")
346 {
347 return "xmlns";
348 }
349 return null;
350 }
string GetNamespaceOfPrefixInScope(string prefix, XElement outOfScope)
Definition XElement.cs:1095

References System.Xml.Linq.XElement.XElement(), System.Xml.Dictionary, System.Xml.Linq.XElement.GetNamespaceOfPrefixInScope(), and System.Xml.Linq.XNamespace.NamespaceName.