/**
  * Adds NewChild as a child tag, and sets it's parent to be this tag.
  *
  * @param NewChild The new tag to add.
  * @return The old parent of NewChild.
  */
 public XMLTag addTag(XMLTag NewChild) {
   if (NewChild != null) {
     ChildTags.add(NewChild);
     NewChild.setParent(this);
     ChildrenCount++;
     fireTagAdded(new XMLPath());
   }
   return NewChild;
 }
 /**
  * Removes UnwantedChild from the child tags.
  *
  * @param UnwantedChild The child to be removed.
  */
 public void removeChild(XMLTag UnwantedChild) {
   if (ChildTags.contains(UnwantedChild)) {
     ChildTags.remove(ChildTags.indexOf(UnwantedChild));
     if (UnwantedChild.getParentTag() == this) {
       UnwantedChild.setParent(null);
     } else {
       UnwantedChild.removeXMLTagListener(this);
     }
     ChildrenCount--;
     fireTagRemoved(new XMLPath());
   }
 }
 /**
  * Replaces OldTag with this tag.
  *
  * @param OldTag The tag to be replaced.
  * @return The parent tag.
  */
 public XMLTag replace(XMLTag OldTag) {
   if (OldTag == null) {
     return null;
   }
   XMLTag NewParentTag = OldTag.getParentTag(); // removeTagFromParent();
   if (NewParentTag != null) {
     // NewParentTag.addTag(this);
     NewParentTag.exchangeChild(OldTag, this);
   }
   ParentTag = NewParentTag;
   OldTag.setParent(null);
   return NewParentTag;
 }