return null;
else {  Node dst = null; switch (sourceNodeType) { case Node.ATTRIBUTE_NODE: { Attr src = (Attr) source; String nodeName = src.getNodeName(); String localName = src.getLocalName(); String namespaceUri = src.getNamespaceURI(); dst = (localName == null) ? createAttribute(nodeName) : createAttributeNS(namespaceUri, nodeName); adoptChildren(src, dst); break; } case Node.CDATA_SECTION_NODE: { CDATASection src = (CDATASection) source; dst = createCDATASection(src.getData()); break; } case Node.COMMENT_NODE: { Comment src = (Comment) source; dst = createComment(src.getData()); break; } case Node.DOCUMENT_FRAGMENT_NODE: { DocumentFragment src = (DocumentFragment) source; dst = createDocumentFragment(); adoptChildren(src, dst); break; } case Node.ELEMENT_NODE: { Element src = (Element) source; String nodeName = src.getNodeName(); String localName = src.getLocalName(); String namespaceUri = src.getNamespaceURI(); dst = (localName == null) ? createElement(nodeName) : createElementNS(namespaceUri, nodeName); adoptAttributes(src, dst); adoptChildren(src, dst); break; } case Node.ENTITY_REFERENCE_NODE: { EntityReference src = (EntityReference) source; dst = createEntityReference(src.getNodeName()); adoptChildren(src, dst); break; } case Node.PROCESSING_INSTRUCTION_NODE: { ProcessingInstruction src = (ProcessingInstruction) source; dst = createProcessingInstruction(src.getTarget(), src.getData()); break; } case Node.TEXT_NODE: { Text src = (Text) source; dst = createTextNode(src.getData()); break; } } return dst; }
  public Node adoptNode(Node source)  {    switch (source.getNodeType())      {      case DOCUMENT_NODE:      case DOCUMENT_TYPE_NODE:        throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR);      case ENTITY_NODE:      case NOTATION_NODE:        throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);      }    if (source instanceof DomNode)      {        DomNode src = (DomNode) source;        DomNode dst = src;        if (dst.parent != null)          {            dst = (DomNode) dst.cloneNode(true);          }        dst.setOwner(this);        src.notifyUserDataHandlers(UserDataHandler.NODE_ADOPTED, src, dst);        return dst;      }    return null;  }