code: public Node cloneNode(boolean deep) {
          try {
              if (isXMLDoc == UNKNOWN_TYPE) isXMLDoc = getDocumentType();
              if (isXMLDoc == NON_XML) {
                  throw new UnsupportedOperationException(
                      "Text document cannot be cloned");
              }
              // initialize a new doc owner node
              initClonedOwnerDoc();
          } catch (ParserConfigurationException e) {
              throw new RuntimeException("Internal Error:" + e);
          }
          if (deep) {
              for (NodeImpl n = (NodeImpl) getFirstChild(); n != null; n = (NodeImpl) n
                  .getNextSibling()) {
                  ownerDocCloned.appendChild(n.cloneNode(ownerDocCloned, true));
              }
          }
          return ownerDocCloned;
      }
docs: {@inheritDoc}
  <p>
  Text documents in MarkLogic cannot be cloned.
  UnsupportedOperationException will be thrown if cloneNode is call on text
  document. </>
  <p>
  DocumentType node will not be cloned as it is not part of the Expanded
  Tree.</>