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

◆ PushNamespaceExplicit()

bool System.Xml.XmlWellFormedWriter.PushNamespaceExplicit ( string prefix,
string ns )
inlineprivate

Definition at line 2605 of file XmlWellFormedWriter.cs.

2606 {
2607 bool result = true;
2608 int num = LookupNamespaceIndex(prefix);
2609 if (num != -1)
2610 {
2611 if (num > _elemScopeStack[_elemTop].prevNSTop)
2612 {
2613 if (_nsStack[num].namespaceUri != ns)
2614 {
2615 throw new XmlException(System.SR.Xml_RedefinePrefix, new string[3]
2616 {
2617 prefix,
2618 _nsStack[num].namespaceUri,
2619 ns
2620 });
2621 }
2622 NamespaceKind kind = _nsStack[num].kind;
2623 if (kind == NamespaceKind.Written)
2624 {
2625 throw DupAttrException((prefix.Length == 0) ? string.Empty : "xmlns", (prefix.Length == 0) ? "xmlns" : prefix);
2626 }
2627 if (_omitDuplNamespaces && kind != NamespaceKind.NeedToWrite)
2628 {
2629 result = false;
2630 }
2631 _nsStack[num].kind = NamespaceKind.Written;
2632 return result;
2633 }
2634 if (_nsStack[num].namespaceUri == ns && _omitDuplNamespaces)
2635 {
2636 result = false;
2637 }
2638 }
2639 else if (_predefinedNamespaces != null)
2640 {
2642 if (text == ns && _omitDuplNamespaces)
2643 {
2644 result = false;
2645 }
2646 }
2647 if ((ns == "http://www.w3.org/XML/1998/namespace" && prefix != "xml") || (ns == "http://www.w3.org/2000/xmlns/" && prefix != "xmlns"))
2648 {
2650 }
2651 if (prefix.Length > 0 && prefix[0] == 'x')
2652 {
2653 if (prefix == "xml")
2654 {
2655 if (ns != "http://www.w3.org/XML/1998/namespace")
2656 {
2658 }
2659 }
2660 else if (prefix == "xmlns")
2661 {
2663 }
2664 }
2665 AddNamespace(prefix, ns, NamespaceKind.Written);
2666 return result;
2667 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Xml_XmlPrefix
Definition SR.cs:304
static string Xml_RedefinePrefix
Definition SR.cs:328
static string Xml_NamespaceDeclXmlXmlns
Definition SR.cs:308
static string Xml_XmlnsPrefix
Definition SR.cs:306
Definition SR.cs:7
void AddNamespace(string prefix, string ns, NamespaceKind kind)
static XmlException DupAttrException(string prefix, string localName)
readonly IXmlNamespaceResolver _predefinedNamespaces
string? LookupNamespace(string prefix)

References System.Xml.XmlWellFormedWriter._elemScopeStack, System.Xml.XmlWellFormedWriter._elemTop, System.Xml.XmlWellFormedWriter._nsStack, System.Xml.XmlWellFormedWriter._omitDuplNamespaces, System.Xml.XmlWellFormedWriter._predefinedNamespaces, System.Xml.XmlWellFormedWriter.AddNamespace(), System.Xml.ArgumentException, System.Xml.Dictionary, System.Xml.XmlWellFormedWriter.DupAttrException(), System.SR.Format(), System.Xml.XmlWellFormedWriter.Namespace.kind, System.Xml.IXmlNamespaceResolver.LookupNamespace(), System.Xml.XmlWellFormedWriter.LookupNamespaceIndex(), System.prefix, System.text, System.SR.Xml_NamespaceDeclXmlXmlns, System.SR.Xml_RedefinePrefix, System.SR.Xml_XmlnsPrefix, System.SR.Xml_XmlPrefix, and System.Xml.XmlException.

Referenced by System.Xml.XmlWellFormedWriter.WriteEndAttribute(), and System.Xml.XmlWellFormedWriter.WriteEndAttributeAsync_SepcialAtt().