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

◆ InsertBefore()

virtual ? XmlNode System.Xml.XmlNode.InsertBefore ( XmlNode newChild,
XmlNode? refChild )
inlinevirtualinherited

Reimplemented in System.Xml.XmlAttribute.

Definition at line 445 of file XmlNode.cs.

446 {
447 if (this == newChild || AncestorNode(newChild))
448 {
450 }
451 if (refChild == null)
452 {
453 return AppendChild(newChild);
454 }
455 if (!IsContainer)
456 {
458 }
459 if (refChild.ParentNode != this)
460 {
462 }
463 if (newChild == refChild)
464 {
465 return newChild;
466 }
467 XmlDocument ownerDocument = newChild.OwnerDocument;
468 XmlDocument ownerDocument2 = OwnerDocument;
469 if (ownerDocument != null && ownerDocument != ownerDocument2 && ownerDocument != this)
470 {
472 }
474 {
476 }
477 if (newChild.ParentNode != null)
478 {
479 newChild.ParentNode.RemoveChild(newChild);
480 }
481 if (newChild.NodeType == XmlNodeType.DocumentFragment)
482 {
483 XmlNode firstChild = newChild.FirstChild;
485 if (xmlNode != null)
486 {
487 newChild.RemoveChild(xmlNode);
490 }
491 return firstChild;
492 }
493 if (!(newChild is XmlLinkedNode) || !IsValidChildType(newChild.NodeType))
494 {
496 }
497 XmlLinkedNode xmlLinkedNode = (XmlLinkedNode)newChild;
498 XmlLinkedNode xmlLinkedNode2 = (XmlLinkedNode)refChild;
499 string value = newChild.Value;
500 XmlNodeChangedEventArgs eventArgs = GetEventArgs(newChild, newChild.ParentNode, this, value, value, XmlNodeChangedAction.Insert);
501 if (eventArgs != null)
502 {
504 }
506 {
509 xmlLinkedNode.SetParent(this);
510 if (xmlLinkedNode.IsText && xmlLinkedNode2.IsText)
511 {
513 }
514 }
515 else
516 {
517 XmlLinkedNode xmlLinkedNode3 = (XmlLinkedNode)xmlLinkedNode2.PreviousSibling;
520 xmlLinkedNode.SetParent(this);
521 if (xmlLinkedNode3.IsText)
522 {
523 if (xmlLinkedNode.IsText)
524 {
526 if (xmlLinkedNode2.IsText)
527 {
529 }
530 }
531 else if (xmlLinkedNode2.IsText)
532 {
534 }
535 }
536 else if (xmlLinkedNode.IsText && xmlLinkedNode2.IsText)
537 {
539 }
540 }
541 if (eventArgs != null)
542 {
544 }
545 return xmlLinkedNode;
546 }
static string Xdom_Node_Insert_Contain
Definition SR.cs:1330
static string Xdom_Node_Insert_TypeConflict
Definition SR.cs:1338
static string Xdom_Node_Insert_Context
Definition SR.cs:1334
static string Xdom_Node_Insert_Child
Definition SR.cs:1328
static string Xdom_Node_Insert_Location
Definition SR.cs:1336
static string Xdom_Node_Insert_Path
Definition SR.cs:1332
Definition SR.cs:7
virtual XmlNodeChangedEventArgs GetEventArgs(XmlNode node, XmlNode oldParent, XmlNode newParent, string oldValue, string newValue, XmlNodeChangedAction action)
Definition XmlNode.cs:1239
bool AncestorNode(XmlNode node)
Definition XmlNode.cs:421
virtual bool CanInsertBefore(XmlNode newChild, XmlNode refChild)
Definition XmlNode.cs:857
virtual bool IsContainer
Definition XmlNode.cs:124
static void NestTextNodes(XmlNode prevNode, XmlNode nextNode)
Definition XmlNode.cs:1274
virtual void AfterEvent(XmlNodeChangedEventArgs args)
Definition XmlNode.cs:1261
virtual void BeforeEvent(XmlNodeChangedEventArgs args)
Definition XmlNode.cs:1253
virtual bool IsValidChildType(XmlNodeType type)
Definition XmlNode.cs:852
static void UnnestTextNodes(XmlNode prevNode, XmlNode nextNode)
Definition XmlNode.cs:1279
virtual ? XmlNode InsertAfter(XmlNode newChild, XmlNode? refChild)
Definition XmlNode.cs:548
virtual ? XmlDocument OwnerDocument
Definition XmlNode.cs:109
virtual ? XmlNode InsertBefore(XmlNode newChild, XmlNode? refChild)
Definition XmlNode.cs:445
virtual ? XmlNode FirstChild
Definition XmlNode.cs:120

References System.Xml.XmlNode.AfterEvent(), System.Xml.XmlNode.AncestorNode(), System.Xml.AppendChild, System.Xml.ArgumentException, System.Xml.XmlNode.BeforeEvent(), System.Xml.XmlNode.CanInsertBefore(), System.Xml.Dictionary, System.Xml.XmlNode.FirstChild, System.Xml.XmlNode.GetEventArgs(), System.Xml.XmlNode.InsertAfter(), System.Xml.XmlNode.InsertBefore(), System.Xml.XmlNode.IsContainer, System.Xml.XmlNode.IsValidChildType(), System.Xml.XmlNode.NestTextNodes(), System.Xml.XmlDocument.OwnerDocument, System.Xml.XmlNode.OwnerDocument, System.Xml.XmlLinkedNode.PreviousSibling, System.Xml.XmlNode.RemoveChild(), System.Xml.XmlNode.UnnestTextNodes(), System.value, System.Xml.XmlNode.Value, System.SR.Xdom_Node_Insert_Child, System.SR.Xdom_Node_Insert_Contain, System.SR.Xdom_Node_Insert_Context, System.SR.Xdom_Node_Insert_Location, System.SR.Xdom_Node_Insert_Path, and System.SR.Xdom_Node_Insert_TypeConflict.

Referenced by System.Xml.Serialization.XmlSchemaExporter.AddXmlnsAnnotation(), System.Xml.DocumentXmlWriter.Close(), System.Data.XmlTreeGen.HandleTable(), System.Xml.XmlUnspecifiedAttribute.InsertBefore(), System.Xml.XmlAttribute.InsertBefore(), System.Xml.XmlNode.InsertBefore(), System.Xml.XmlNode.PrependChild(), System.Xml.XmlNode.ReplaceChild(), and System.Xml.XmlDataDocument.ReplaceInitialChildText().