Пример #1
0
  /** Resets the parser configuration. */
  protected void reset() throws XMLConfigurationException {

    // reset components
    int size = fHTMLComponents.size();
    for (int i = 0; i < size; i++) {
      HTMLComponent component = (HTMLComponent) fHTMLComponents.elementAt(i);
      component.reset(this);
    }

    // configure pipeline
    XMLDocumentSource lastSource = fDocumentScanner;
    if (getFeature(NAMESPACES)) {
      lastSource.setDocumentHandler(fNamespaceBinder);
      fNamespaceBinder.setDocumentSource(fTagBalancer);
      lastSource = fNamespaceBinder;
    }
    if (getFeature(BALANCE_TAGS)) {
      lastSource.setDocumentHandler(fTagBalancer);
      fTagBalancer.setDocumentSource(fDocumentScanner);
      lastSource = fTagBalancer;
    }
    XMLDocumentFilter[] filters = (XMLDocumentFilter[]) getProperty(FILTERS);
    if (filters != null) {
      for (int i = 0; i < filters.length; i++) {
        XMLDocumentFilter filter = filters[i];
        XercesBridge.getInstance().XMLDocumentFilter_setDocumentSource(filter, lastSource);
        lastSource.setDocumentHandler(filter);
        lastSource = filter;
      }
    }
    lastSource.setDocumentHandler(fDocumentHandler);
  } // reset()
Пример #2
0
 /**
  * Sets the document handler on the last component in the pipeline to receive information about
  * the document.
  *
  * @param documentHandler The document handler.
  */
 public void setDocumentHandler(XMLDocumentHandler documentHandler) {
   fDocumentHandler = documentHandler;
   if (fLastComponent != null) {
     fLastComponent.setDocumentHandler(fDocumentHandler);
     if (fDocumentHandler != null) {
       fDocumentHandler.setDocumentSource(fLastComponent);
     }
   }
 } // setDocumentHandler(XMLDocumentHandler)