code: public void setNode(Node node) {
          // does the corrent parent/child relationship exist?
          if (nextSibling != null) {
              // cannot be a sibling of a null node
              if (node == null) {
                  throw new IllegalStateException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
              }
  
              // nextSibling contained by node?
              if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
                  throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
              }
          }
  
          this.node = node;
      }
docs: <p>Set the node that will contain the result DOM tree.<p>
  
  <p>In practice, the node should be
  a {@link org.w3c.dom.Document} node,
  a {@link org.w3c.dom.DocumentFragment} node, or
  a {@link org.w3c.dom.Element} node.
  In other words, a node that accepts children.</p>
  
  <p>An <code>IllegalStateException</code> is thrown if <code>nextSibling</code> is not <code>null</code> and
  <code>node</code> is not a parent of <code>nextSibling</code>.
  An <code>IllegalStateException</code> is thrown if <code>node</code> is <code>null</code> and
  <code>nextSibling</code> is not <code>null</code>.</p>
  
  @param node The node to which the transformation will be appended.
  
  @throws IllegalStateException If <code>nextSibling</code> is not <code>null</code> and
  <code>nextSibling</code> is not a child of <code>node</code>.
  @throws IllegalStateException If <code>node</code> is <code>null</code> and
  <code>nextSibling</code> is not <code>null</code>.