/**
  * Adds NewChild as a child, but doesn't alter NewChild's parent status.
  *
  * <p>This means that the child tag will turn up in a search of this tags children, but this tag
  * will not be locatable from the child.
  *
  * @param NewChild The tag to share.
  * @return The real parent of NewChild.
  */
 public XMLTag shareTag(XMLTag NewChild) {
   if (NewChild != null) {
     ChildTags.add(NewChild);
     NewChild.addXMLTagListener(this);
     ChildrenCount++;
     fireTagAdded(new XMLPath());
   }
   return NewChild.getParentTag();
 }
 /**
  * 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;
 }