throw new DomEx(DomEx.NOT_SUPPORTED_ERR, null, src, 0);
throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, null, src, 0);
  public Node importNode(Node src, boolean deep)  {    Node dst = null;    switch (src.getNodeType())      {      case TEXT_NODE:        dst = createTextNode(src.getNodeValue());        break;      case CDATA_SECTION_NODE:        dst = createCDATASection(src.getNodeValue());        break;      case COMMENT_NODE:        dst = createComment(src.getNodeValue());        break;      case PROCESSING_INSTRUCTION_NODE:        dst = createProcessingInstruction(src.getNodeName(),                                          src.getNodeValue());        break;      case NOTATION_NODE:        // NOTE:  There's no standard way to create        // these, or add them to a doctype.  Useless.        Notation notation = (Notation) src;        dst = new DomNotation(this, notation.getNodeName(),                              notation.getPublicId(),                              notation.getSystemId());        break;      case ENTITY_NODE:        // NOTE:  There's no standard way to create        // these, or add them to a doctype.  Useless.        Entity entity = (Entity) src;        dst = new DomEntity(this, entity.getNodeName(),                            entity.getPublicId(),                            entity.getSystemId(),                            entity.getNotationName());        if (deep)          {            for (Node ctx = src.getFirstChild(); ctx != null;                 ctx = ctx.getNextSibling())              {                dst.appendChild(importNode(ctx, deep));              }          }        break;      case ENTITY_REFERENCE_NODE:        dst = createEntityReference(src.getNodeName());        break;      case DOCUMENT_FRAGMENT_NODE:        dst = new DomFragment(this);        if (deep)          {            for (Node ctx = src.getFirstChild(); ctx != null;                 ctx = ctx.getNextSibling())              {                dst.appendChild(importNode(ctx, deep));              }          }        break;      case ATTRIBUTE_NODE:        String attr_nsuri = src.getNamespaceURI();        if (attr_nsuri != null)          {            dst = createAttributeNS(attr_nsuri, src.getNodeName());          }        else          {            dst = createAttribute(src.getNodeName());          }        // this is _always_ done regardless of "deep" setting        for (Node ctx = src.getFirstChild(); ctx != null;             ctx = ctx.getNextSibling())          {            dst.appendChild(importNode(ctx, false));          }        break;      case ELEMENT_NODE:        String elem_nsuri = src.getNamespaceURI();        if (elem_nsuri != null)          {            dst = createElementNS(elem_nsuri, src.getNodeName());          }        else          {            dst = createElement(src.getNodeName());          }        NamedNodeMap srcAttrs = src.getAttributes();        NamedNodeMap dstAttrs = dst.getAttributes();        int len = srcAttrs.getLength();        for (int i = 0; i < len; i++)          {            Attr a = (Attr) srcAttrs.item(i);            Attr dflt;                        // maybe update defaulted attributes            dflt = (Attr) dstAttrs.getNamedItem(a.getNodeName());            if (dflt != null)              {                String newval = a.getNodeValue();                if (!dflt.getNodeValue().equals(newval)                    || a.getSpecified () == true)                  {                    dflt.setNodeValue (newval);                  }                continue;              }                        dstAttrs.setNamedItem((Attr) importNode(a, false));          }        if (deep)          {            for (Node ctx = src.getFirstChild(); ctx != null;                 ctx = ctx.getNextSibling())              {                dst.appendChild(importNode(ctx, true));              }          }        break;        // can't import document or doctype nodes      case DOCUMENT_NODE:      case DOCUMENT_TYPE_NODE:        // FALLTHROUGH        // can't import unrecognized or nonstandard nodes      default:        throw new DomEx(DomEx.NOT_SUPPORTED_ERR, null, src, 0);      }        // FIXME cleanup a bit -- for deep copies, copy those    // children in one place, here (code sharing is healthy)    if (src instanceof DomNode)      {        ((DomNode) src).notifyUserDataHandlers(UserDataHandler.NODE_IMPORTED,                                               src, dst);      }    return dst;  }