code: public void replace(XElement oldChild, XElement newChild) {
          int idx = children.indexOf(oldChild);
          if (idx >= 0) {
              children.get(idx).parent = null;
              children.set(idx, newChild);
              newChild.parent = this;
          }
      }
docs: Replaces the specified child node with the new node. If the old node is not present
  the method does nothing.
  @param oldChild the old child
  @param newChild the new child