/**
   * Implements org.xml.sax.ContentHandler.endDocument() Receive notification of the end of a
   * document.
   */
  public void endDocument() throws SAXException {
    // Signal to the DOMBuilder that the document is complete
    _handler.endDocument();

    if (!_isIdentity) {
      // Run the transformation now if we have a reference to a Result object
      if (_result != null) {
        try {
          _transformer.setDOM(_dom);
          _transformer.transform(null, _result);
        } catch (TransformerException e) {
          throw new SAXException(e);
        }
      }
      // Signal that the internal DOM is built (see 'setResult()').
      _done = true;

      // Set this DOM as the transformer's DOM
      _transformer.setDOM(_dom);
    }
    if (_isIdentity && _result instanceof DOMResult) {
      ((DOMResult) _result).setNode(_transformer.getTransletOutputHandlerFactory().getNode());
    }
  }