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

◆ RemoveDuplicateNamespace()

void System.Xml.XmlLoader.RemoveDuplicateNamespace ( XmlElement elem,
XmlNamespaceManager mgr,
bool fCheckElemAttrs )
inlineprivate

Definition at line 662 of file XmlLoader.cs.

663 {
664 mgr.PushScope();
665 XmlAttributeCollection attributes = elem.Attributes;
666 int count = attributes.Count;
667 if (fCheckElemAttrs && count > 0)
668 {
669 for (int num = count - 1; num >= 0; num--)
670 {
671 XmlAttribute xmlAttribute = attributes[num];
672 if (xmlAttribute.Prefix == _doc.strXmlns)
673 {
674 string text = mgr.LookupNamespace(xmlAttribute.LocalName);
675 if (text != null)
676 {
677 if (xmlAttribute.Value == text)
678 {
679 elem.Attributes.RemoveNodeAt(num);
680 }
681 }
682 else
683 {
684 mgr.AddNamespace(xmlAttribute.LocalName, xmlAttribute.Value);
685 }
686 }
687 else if (xmlAttribute.Prefix.Length == 0 && xmlAttribute.LocalName == _doc.strXmlns)
688 {
689 string defaultNamespace = mgr.DefaultNamespace;
690 if (defaultNamespace != null)
691 {
692 if (xmlAttribute.Value == defaultNamespace)
693 {
694 elem.Attributes.RemoveNodeAt(num);
695 }
696 }
697 else
698 {
699 mgr.AddNamespace(xmlAttribute.LocalName, xmlAttribute.Value);
700 }
701 }
702 }
703 }
704 for (XmlNode xmlNode = elem.FirstChild; xmlNode != null; xmlNode = xmlNode.NextSibling)
705 {
706 if (xmlNode is XmlElement elem2)
707 {
709 }
710 }
711 mgr.PopScope();
712 }
void RemoveDuplicateNamespace(XmlElement elem, XmlNamespaceManager mgr, bool fCheckElemAttrs)
Definition XmlLoader.cs:662
XmlDocument _doc
Definition XmlLoader.cs:9

References System.Xml.XmlLoader._doc, System.count, System.Xml.XmlAttributeCollection.Count, System.Xml.XmlLoader.RemoveDuplicateNamespace(), System.Xml.XmlDocument.strXmlns, and System.text.

Referenced by System.Xml.XmlLoader.LoadInnerXmlElement(), and System.Xml.XmlLoader.RemoveDuplicateNamespace().