/**
   * Implements org.xml.sax.ContentHandler.startDocument() Receive notification of the beginning of
   * a document.
   */
  public void startDocument() throws SAXException {
    // Make sure setResult() was called before the first SAX event
    if (_result == null) {
      ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_SET_RESULT_ERR);
      throw new SAXException(err.toString());
    }

    if (!_isIdentity) {
      boolean hasIdCall = (_translet != null) ? _translet.hasIdCall() : false;
      XSLTCDTMManager dtmManager = null;

      // Create an internal DOM (not W3C) and get SAX2 input handler
      try {
        dtmManager =
            (XSLTCDTMManager)
                _transformer.getTransformerFactory().getDTMManagerClass().newInstance();
      } catch (Exception e) {
        throw new SAXException(e);
      }

      DTMWSFilter wsFilter;
      if (_translet != null && _translet instanceof StripFilter) {
        wsFilter = new DOMWSFilter(_translet);
      } else {
        wsFilter = null;
      }

      // Construct the DTM using the SAX events that come through
      _dom = (SAXImpl) dtmManager.getDTM(null, false, wsFilter, true, false, hasIdCall);

      _handler = _dom.getBuilder();
      _lexHandler = (LexicalHandler) _handler;
      _dtdHandler = (DTDHandler) _handler;
      _declHandler = (DeclHandler) _handler;

      // Set document URI
      _dom.setDocumentURI(_systemId);

      if (_locator != null) {
        _handler.setDocumentLocator(_locator);
      }
    }

    // Proxy call
    _handler.startDocument();
  }