コード例 #1
0
  /** Configures the pipeline. */
  protected void configurePipeline() {
    // create appropriate scanner
    // and register it as one of the components.
    if (fFeatures.get(NAMESPACES) == Boolean.TRUE) {
      if (fNamespaceScanner == null) {
        fNamespaceScanner = new XMLNSDocumentScannerImpl();
        addComponent((XMLComponent) fNamespaceScanner);
      }
      fProperties.put(DOCUMENT_SCANNER, fNamespaceScanner);
      fNamespaceScanner.setDTDValidator(null);
      fScanner = fNamespaceScanner;
    } else {
      if (fNonNSScanner == null) {
        fNonNSScanner = new XMLDocumentScannerImpl();
        addComponent((XMLComponent) fNonNSScanner);
      }
      fProperties.put(DOCUMENT_SCANNER, fNonNSScanner);
      fScanner = fNonNSScanner;
    }

    fScanner.setDocumentHandler(fDocumentHandler);
    fLastComponent = fScanner;
    // setup dtd pipeline
    if (fDTDScanner != null) {
      fDTDScanner.setDTDHandler(fDTDHandler);
      fDTDScanner.setDTDContentModelHandler(fDTDContentModelHandler);
    }
  } // configurePipeline()
コード例 #2
0
  /** Configures the pipeline. */
  protected void configurePipeline() {
    if (fCurrentDVFactory != fDatatypeValidatorFactory) {
      fCurrentDVFactory = fDatatypeValidatorFactory;
      // use XML 1.0 datatype library
      setProperty(DATATYPE_VALIDATOR_FACTORY, fCurrentDVFactory);
    }

    // setup DTD pipeline
    if (fCurrentDTDScanner != fDTDScanner) {
      fCurrentDTDScanner = fDTDScanner;
      setProperty(DTD_SCANNER, fCurrentDTDScanner);
      setProperty(DTD_PROCESSOR, fDTDProcessor);
    }
    fDTDScanner.setDTDHandler(fDTDProcessor);
    fDTDProcessor.setDTDSource(fDTDScanner);
    fDTDProcessor.setDTDHandler(fDTDHandler);
    if (fDTDHandler != null) {
      fDTDHandler.setDTDSource(fDTDProcessor);
    }

    fDTDScanner.setDTDContentModelHandler(fDTDProcessor);
    fDTDProcessor.setDTDContentModelSource(fDTDScanner);
    fDTDProcessor.setDTDContentModelHandler(fDTDContentModelHandler);
    if (fDTDContentModelHandler != null) {
      fDTDContentModelHandler.setDTDContentModelSource(fDTDProcessor);
    }

    // setup document pipeline
    if (fFeatures.get(NAMESPACES) == Boolean.TRUE) {
      if (fCurrentScanner != fNamespaceScanner) {
        fCurrentScanner = fNamespaceScanner;
        setProperty(DOCUMENT_SCANNER, fNamespaceScanner);
        setProperty(DTD_VALIDATOR, fDTDValidator);
      }
      fNamespaceScanner.setDTDValidator(fDTDValidator);
      fNamespaceScanner.setDocumentHandler(fDTDValidator);
      fDTDValidator.setDocumentSource(fNamespaceScanner);
      fDTDValidator.setDocumentHandler(fDocumentHandler);
      if (fDocumentHandler != null) {
        fDocumentHandler.setDocumentSource(fDTDValidator);
      }
      fLastComponent = fDTDValidator;
    } else {
      // create components
      if (fNonNSScanner == null) {
        fNonNSScanner = new XMLDocumentScannerImpl();
        fNonNSDTDValidator = new XMLDTDValidator();
        // add components
        addComponent((XMLComponent) fNonNSScanner);
        addComponent((XMLComponent) fNonNSDTDValidator);
      }
      if (fCurrentScanner != fNonNSScanner) {
        fCurrentScanner = fNonNSScanner;
        setProperty(DOCUMENT_SCANNER, fNonNSScanner);
        setProperty(DTD_VALIDATOR, fNonNSDTDValidator);
      }

      fNonNSScanner.setDocumentHandler(fNonNSDTDValidator);
      fNonNSDTDValidator.setDocumentSource(fNonNSScanner);
      fNonNSDTDValidator.setDocumentHandler(fDocumentHandler);
      if (fDocumentHandler != null) {
        fDocumentHandler.setDocumentSource(fNonNSDTDValidator);
      }
      fLastComponent = fNonNSDTDValidator;
    }
  } // configurePipeline()