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

◆ LookupPrefix()

string System.Xml.XmlBaseWriter.NamespaceManager.LookupPrefix ( string ns)
inline

Definition at line 469 of file XmlBaseWriter.cs.

470 {
471 if (_lastNameSpace != null && _lastNameSpace.Uri == ns)
472 {
473 return _lastNameSpace.Prefix;
474 }
475 int nsCount = _nsCount;
476 for (int num = nsCount - 1; num >= _nsTop; num--)
477 {
478 Namespace @namespace = _namespaces[num];
479 if ((object)@namespace.Uri == ns)
480 {
481 string prefix = @namespace.Prefix;
482 bool flag = false;
483 for (int i = num + 1; i < nsCount; i++)
484 {
485 if (_namespaces[i].Prefix == prefix)
486 {
487 flag = true;
488 break;
489 }
490 }
491 if (!flag)
492 {
493 _lastNameSpace = @namespace;
494 return prefix;
495 }
496 }
497 }
498 for (int num2 = nsCount - 1; num2 >= _nsTop; num2--)
499 {
501 if (namespace2.Uri == ns)
502 {
503 string prefix2 = namespace2.Prefix;
504 bool flag2 = false;
505 for (int j = num2 + 1; j < nsCount; j++)
506 {
507 if (_namespaces[j].Prefix == prefix2)
508 {
509 flag2 = true;
510 break;
511 }
512 }
513 if (!flag2)
514 {
516 return prefix2;
517 }
518 }
519 }
520 if (ns.Length == 0)
521 {
522 bool flag3 = true;
523 for (int num3 = nsCount - 1; num3 >= _nsTop; num3--)
524 {
525 if (_namespaces[num3].Prefix.Length == 0)
526 {
527 flag3 = false;
528 break;
529 }
530 }
531 if (flag3)
532 {
533 return string.Empty;
534 }
535 }
536 if (ns == "http://www.w3.org/2000/xmlns/")
537 {
538 return "xmlns";
539 }
540 if (ns == "http://www.w3.org/XML/1998/namespace")
541 {
542 return "xml";
543 }
544 return null;
545 }

References System.Xml.XmlBaseWriter.NamespaceManager._lastNameSpace, System.Xml.XmlBaseWriter.NamespaceManager._namespaces, System.Xml.XmlBaseWriter.NamespaceManager._nsCount, System.Xml.XmlBaseWriter.NamespaceManager._nsTop, System.Runtime.Serialization.Dictionary, System.Xml.Dictionary, System.prefix, System.Xml.XmlBaseWriter.NamespaceManager.Namespace.Prefix, and System.Xml.XmlBaseWriter.NamespaceManager.Namespace.Uri.

Referenced by System.Xml.XmlBaseWriter.GetQualifiedNamePrefix(), System.Xml.XmlBaseWriter.LookupPrefix(), System.Xml.XmlBaseWriter.StartElement(), System.Xml.XmlBaseWriter.StartElementAsync(), System.Xml.XmlBaseWriter.WriteXmlnsAttribute(), and System.Xml.XmlBaseWriter.WriteXmlnsAttribute().