code: protected void adoptElement(DomXmlElement elementToAdopt) {
      Document document = this.domElement.getOwnerDocument();
      Element element = elementToAdopt.domElement;
  
      if (!document.equals(element.getOwnerDocument())) {
        Node node = document.adoptNode(element);
        if (node == null) {
          throw LOG.unableToAdoptElement(elementToAdopt);
        }
      }
    }
docs: Adopts an xml dom element to the owner document of this element if necessary.
  
  @param elementToAdopt the element to adopt