/** Start document. */
  public void startDocument(
      XMLLocator locator, String encoding, NamespaceContext nscontext, Augmentations augs)
      throws XNIException {

    // perform default handling
    // NOTE: using own namespace context
    super.startDocument(locator, encoding, fNamespaceContext, augs);
  } // startDocument(XMLLocator,String,NamespaceContext,Augmentations)
  /**
   * Resets the component. The component can query the component manager about any features and
   * properties that affect the operation of the component.
   *
   * @param manager The component manager.
   * @throws XNIException Thrown by component on initialization error.
   */
  public void reset(XMLComponentManager manager) throws XMLConfigurationException {
    super.reset(manager);

    // features
    fNamespaces = manager.getFeature(NAMESPACES);
    fOverrideNamespaces = manager.getFeature(OVERRIDE_NAMESPACES);
    fInsertNamespaces = manager.getFeature(INSERT_NAMESPACES);

    // get properties
    fNamesElems = getNamesValue(String.valueOf(manager.getProperty(NAMES_ELEMS)));
    fNamesAttrs = getNamesValue(String.valueOf(manager.getProperty(NAMES_ATTRS)));
    fNamespacesURI = String.valueOf(manager.getProperty(NAMESPACES_URI));

    // initialize state
    fNamespaceContext.reset();
  } // reset(XMLComponentManager)
  /** Start element. */
  public void startElement(QName element, XMLAttributes attrs, Augmentations augs)
      throws XNIException {

    // bind namespaces, if needed
    if (fNamespaces) {
      fNamespaceContext.pushContext();
      bindNamespaces(element, attrs);

      int dcount = fNamespaceContext.getDeclaredPrefixCount();
      if (fDocumentHandler != null && dcount > 0) {
        for (int i = 0; i < dcount; i++) {
          String prefix = fNamespaceContext.getDeclaredPrefixAt(i);
          String uri = fNamespaceContext.getURI(prefix);
          XercesBridge.getInstance()
              .XMLDocumentHandler_startPrefixMapping(fDocumentHandler, prefix, uri, augs);
        }
      }
    }

    // perform default handling
    super.startElement(element, attrs, augs);
  } // startElement(QName,XMLAttributes,Augmentations)
  /** End element. */
  public void endElement(QName element, Augmentations augs) throws XNIException {

    // bind namespaces, if needed
    if (fNamespaces) {
      bindNamespaces(element, null);
    }

    // perform default handling
    super.endElement(element, augs);

    // pop context
    if (fNamespaces) {
      int dcount = fNamespaceContext.getDeclaredPrefixCount();
      if (fDocumentHandler != null && dcount > 0) {
        for (int i = dcount - 1; i >= 0; i--) {
          String prefix = fNamespaceContext.getDeclaredPrefixAt(i);
          XercesBridge.getInstance()
              .XMLDocumentHandler_endPrefixMapping(fDocumentHandler, prefix, augs);
        }
      }

      fNamespaceContext.popContext();
    }
  } // endElement(QName,Augmentations)