Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.apache.xerces.parsers;
  
  import java.util.HashMap;
  import java.util.Locale;
 
 public class DTDConfiguration extends BasicParserConfiguration
 {
   protected static final String WARN_ON_DUPLICATE_ATTDEF = "http://apache.org/xml/features/validation/warn-on-duplicate-attdef";
   protected static final String WARN_ON_DUPLICATE_ENTITYDEF = "http://apache.org/xml/features/warn-on-duplicate-entitydef";
   protected static final String WARN_ON_UNDECLARED_ELEMDEF = "http://apache.org/xml/features/validation/warn-on-undeclared-elemdef";
   protected static final String ALLOW_JAVA_ENCODINGS = "http://apache.org/xml/features/allow-java-encodings";
   protected static final String CONTINUE_AFTER_FATAL_ERROR = "http://apache.org/xml/features/continue-after-fatal-error";
   protected static final String LOAD_EXTERNAL_DTD = "http://apache.org/xml/features/nonvalidating/load-external-dtd";
   protected static final String NOTIFY_BUILTIN_REFS = "http://apache.org/xml/features/scanner/notify-builtin-refs";
   protected static final String NOTIFY_CHAR_REFS = "http://apache.org/xml/features/scanner/notify-char-refs";
   protected static final String ERROR_REPORTER = "http://apache.org/xml/properties/internal/error-reporter";
   protected static final String ENTITY_MANAGER = "http://apache.org/xml/properties/internal/entity-manager";
   protected static final String DOCUMENT_SCANNER = "http://apache.org/xml/properties/internal/document-scanner";
   protected static final String DTD_SCANNER = "http://apache.org/xml/properties/internal/dtd-scanner";
   protected static final String XMLGRAMMAR_POOL = "http://apache.org/xml/properties/internal/grammar-pool";
   protected static final String DTD_PROCESSOR = "http://apache.org/xml/properties/internal/dtd-processor";
   protected static final String DTD_VALIDATOR = "http://apache.org/xml/properties/internal/validator/dtd";
   protected static final String NAMESPACE_BINDER = "http://apache.org/xml/properties/internal/namespace-binder";
   protected static final String DATATYPE_VALIDATOR_FACTORY = "http://apache.org/xml/properties/internal/datatype-validator-factory";
   protected static final String VALIDATION_MANAGER = "http://apache.org/xml/properties/internal/validation-manager";
   protected static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
   protected static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
   protected static final boolean PRINT_EXCEPTION_STACK_TRACE = false;
   protected XMLGrammarPool fGrammarPool;
   protected XMLDocumentScanner fScanner;
   protected XMLInputSource fInputSource;
   protected XMLDTDScanner fDTDScanner;
   protected XMLDTDProcessor fDTDProcessor;
   protected XMLDTDValidator fDTDValidator;
   protected XMLLocator fLocator;
   protected boolean fParseInProgress = false;
 
   public DTDConfiguration()
   {
     this(nullnullnull);
   }
 
   public DTDConfiguration(SymbolTable paramSymbolTable)
   {
     this(paramSymbolTable, nullnull);
   }
 
   public DTDConfiguration(SymbolTable paramSymbolTableXMLGrammarPool paramXMLGrammarPool)
   {
     this(paramSymbolTable, paramXMLGrammarPool, null);
   }
 
   public DTDConfiguration(SymbolTable paramSymbolTableXMLGrammarPool paramXMLGrammarPoolXMLComponentManager paramXMLComponentManager)
   {
     super(paramSymbolTable, paramXMLComponentManager);
     String[] arrayOfString1 = { "http://apache.org/xml/features/continue-after-fatal-error""http://apache.org/xml/features/nonvalidating/load-external-dtd" };
     addRecognizedFeatures(arrayOfString1);
     setFeature("http://apache.org/xml/features/continue-after-fatal-error"false);
     setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd"true);
     String[] arrayOfString2 = { "http://apache.org/xml/properties/internal/error-reporter""http://apache.org/xml/properties/internal/entity-manager""http://apache.org/xml/properties/internal/document-scanner""http://apache.org/xml/properties/internal/dtd-scanner""http://apache.org/xml/properties/internal/dtd-processor""http://apache.org/xml/properties/internal/validator/dtd""http://apache.org/xml/properties/internal/namespace-binder""http://apache.org/xml/properties/internal/grammar-pool""http://apache.org/xml/properties/internal/datatype-validator-factory""http://apache.org/xml/properties/internal/validation-manager""http://java.sun.com/xml/jaxp/properties/schemaSource""http://java.sun.com/xml/jaxp/properties/schemaLanguage" };
     addRecognizedProperties(arrayOfString2);
     this.fGrammarPool = paramXMLGrammarPool;
     if (this.fGrammarPool != null)
       setProperty("http://apache.org/xml/properties/internal/grammar-pool"this.fGrammarPool);
     this.fEntityManager = createEntityManager();
    setProperty("http://apache.org/xml/properties/internal/entity-manager"this.fEntityManager);
    addComponent(this.fEntityManager);
    this.fErrorReporter = createErrorReporter();
    this.fErrorReporter.setDocumentLocator(this.fEntityManager.getEntityScanner());
    setProperty("http://apache.org/xml/properties/internal/error-reporter"this.fErrorReporter);
    addComponent(this.fErrorReporter);
    this.fScanner = createDocumentScanner();
    setProperty("http://apache.org/xml/properties/internal/document-scanner"this.fScanner);
    if ((this.fScanner instanceof XMLComponent))
      addComponent((XMLComponent)this.fScanner);
    this.fDTDScanner = createDTDScanner();
    if (this.fDTDScanner != null)
    {
      setProperty("http://apache.org/xml/properties/internal/dtd-scanner"this.fDTDScanner);
      if ((this.fDTDScanner instanceof XMLComponent))
        addComponent((XMLComponent)this.fDTDScanner);
    }
    this.fDTDProcessor = createDTDProcessor();
    if (this.fDTDProcessor != null)
    {
      setProperty("http://apache.org/xml/properties/internal/dtd-processor"this.fDTDProcessor);
      if ((this.fDTDProcessor instanceof XMLComponent))
        addComponent(this.fDTDProcessor);
    }
    this.fDTDValidator = createDTDValidator();
    if (this.fDTDValidator != null)
    {
      setProperty("http://apache.org/xml/properties/internal/validator/dtd"this.fDTDValidator);
      addComponent(this.fDTDValidator);
    }
    this.fNamespaceBinder = createNamespaceBinder();
    if (this.fNamespaceBinder != null)
    {
      setProperty("http://apache.org/xml/properties/internal/namespace-binder"this.fNamespaceBinder);
      addComponent(this.fNamespaceBinder);
    }
    this.fDatatypeValidatorFactory = createDatatypeValidatorFactory();
    if (this.fDatatypeValidatorFactory != null)
      setProperty("http://apache.org/xml/properties/internal/datatype-validator-factory"this.fDatatypeValidatorFactory);
    this.fValidationManager = createValidationManager();
    if (this.fValidationManager != null)
      setProperty("http://apache.org/xml/properties/internal/validation-manager"this.fValidationManager);
    if (this.fErrorReporter.getMessageFormatter("http://www.w3.org/TR/1998/REC-xml-19980210") == null)
    {
      XMLMessageFormatter localXMLMessageFormatter = new XMLMessageFormatter();
      this.fErrorReporter.putMessageFormatter("http://www.w3.org/TR/1998/REC-xml-19980210", localXMLMessageFormatter);
      this.fErrorReporter.putMessageFormatter("http://www.w3.org/TR/1999/REC-xml-names-19990114", localXMLMessageFormatter);
    }
    try
    {
      setLocale(Locale.getDefault());
    }
    catch (XNIException localXNIException)
    {
    }
  }
  public void setLocale(Locale paramLocale)
    throws XNIException
  {
    super.setLocale(paramLocale);
    this.fErrorReporter.setLocale(paramLocale);
  }
  public void setInputSource(XMLInputSource paramXMLInputSource)
  {
    this.fInputSource = paramXMLInputSource;
  }
  public boolean parse(boolean paramBoolean)
    throws XNIExceptionIOException
  {
    if (this.fInputSource != null)
      try
      {
        reset();
        this.fScanner.setInputSource(this.fInputSource);
        this.fInputSource = null;
      }
      catch (XNIException localXNIException1)
      {
        throw localXNIException1;
      }
      catch (IOException localIOException1)
      {
        throw localIOException1;
      }
      catch (RuntimeException localRuntimeException1)
      {
        throw localRuntimeException1;
      }
      catch (Exception localException1)
      {
        throw new XNIException(localException1);
      }
    try
    {
      return this.fScanner.scanDocument(paramBoolean);
    }
    catch (XNIException localXNIException2)
    {
      throw localXNIException2;
    }
    catch (IOException localIOException2)
    {
      throw localIOException2;
    }
    catch (RuntimeException localRuntimeException2)
    {
      throw localRuntimeException2;
    }
    catch (Exception localException2)
    {
    }
    throw new XNIException(localException2);
  }
  public void cleanup()
  {
    this.fEntityManager.closeReaders();
  }
  public void parse(XMLInputSource paramXMLInputSource)
    throws XNIExceptionIOException
  {
    if (this.fParseInProgress)
      throw new XNIException("FWK005 parse may not be called while parsing.");
    this.fParseInProgress = true;
    try
    {
      setInputSource(paramXMLInputSource);
      parse(true);
    }
    catch (XNIException localXNIException)
    {
      throw localXNIException;
    }
    catch (IOException localIOException)
    {
      throw localIOException;
    }
    catch (RuntimeException localRuntimeException)
    {
      throw localRuntimeException;
    }
    catch (Exception localException)
    {
      throw new XNIException(localException);
    }
    finally
    {
      this.fParseInProgress = false;
      cleanup();
    }
  }
  protected void reset()
    throws XNIException
  {
    if (this.fValidationManager != null)
      this.fValidationManager.reset();
    configurePipeline();
    super.reset();
  }
  protected void configurePipeline()
  {
    if (this.fDTDValidator != null)
    {
      this.fScanner.setDocumentHandler(this.fDTDValidator);
      if (this.fFeatures.get("http://xml.org/sax/features/namespaces") == Boolean.TRUE)
      {
        this.fDTDValidator.setDocumentHandler(this.fNamespaceBinder);
        this.fDTDValidator.setDocumentSource(this.fScanner);
        this.fNamespaceBinder.setDocumentHandler(this.fDocumentHandler);
        this.fNamespaceBinder.setDocumentSource(this.fDTDValidator);
        this.fLastComponent = this.fNamespaceBinder;
      }
      else
      {
        this.fDTDValidator.setDocumentHandler(this.fDocumentHandler);
        this.fDTDValidator.setDocumentSource(this.fScanner);
        this.fLastComponent = this.fDTDValidator;
      }
    }
    else if (this.fFeatures.get("http://xml.org/sax/features/namespaces") == Boolean.TRUE)
    {
      this.fScanner.setDocumentHandler(this.fNamespaceBinder);
      this.fNamespaceBinder.setDocumentHandler(this.fDocumentHandler);
      this.fNamespaceBinder.setDocumentSource(this.fScanner);
      this.fLastComponent = this.fNamespaceBinder;
    }
    else
    {
      this.fScanner.setDocumentHandler(this.fDocumentHandler);
      this.fLastComponent = this.fScanner;
    }
    configureDTDPipeline();
  }
  protected void configureDTDPipeline()
  {
    if (this.fDTDScanner != null)
    {
      this.fProperties.put("http://apache.org/xml/properties/internal/dtd-scanner"this.fDTDScanner);
      if (this.fDTDProcessor != null)
      {
        this.fProperties.put("http://apache.org/xml/properties/internal/dtd-processor"this.fDTDProcessor);
        this.fDTDScanner.setDTDHandler(this.fDTDProcessor);
        this.fDTDProcessor.setDTDSource(this.fDTDScanner);
        this.fDTDProcessor.setDTDHandler(this.fDTDHandler);
        if (this.fDTDHandler != null)
          this.fDTDHandler.setDTDSource(this.fDTDProcessor);
        this.fDTDScanner.setDTDContentModelHandler(this.fDTDProcessor);
        this.fDTDProcessor.setDTDContentModelSource(this.fDTDScanner);
        this.fDTDProcessor.setDTDContentModelHandler(this.fDTDContentModelHandler);
        if (this.fDTDContentModelHandler != null)
          this.fDTDContentModelHandler.setDTDContentModelSource(this.fDTDProcessor);
      }
      else
      {
        this.fDTDScanner.setDTDHandler(this.fDTDHandler);
        if (this.fDTDHandler != null)
          this.fDTDHandler.setDTDSource(this.fDTDScanner);
        this.fDTDScanner.setDTDContentModelHandler(this.fDTDContentModelHandler);
        if (this.fDTDContentModelHandler != null)
          this.fDTDContentModelHandler.setDTDContentModelSource(this.fDTDScanner);
      }
    }
  }
  protected void checkFeature(String paramString)
  {
    if (paramString.startsWith("http://apache.org/xml/features/"))
    {
      int i = paramString.length() - "http://apache.org/xml/features/".length();
      if ((i == "validation/dynamic".length()) && (paramString.endsWith("validation/dynamic")))
        return;
      short s;
      if ((i == "validation/default-attribute-values".length()) && (paramString.endsWith("validation/default-attribute-values")))
      {
        s = 1;
        throw new XMLConfigurationException(s, paramString);
      }
      if ((i == "validation/validate-content-models".length()) && (paramString.endsWith("validation/validate-content-models")))
      {
        s = 1;
        throw new XMLConfigurationException(s, paramString);
      }
      if ((i == "nonvalidating/load-dtd-grammar".length()) && (paramString.endsWith("nonvalidating/load-dtd-grammar")))
        return;
      if ((i == "nonvalidating/load-external-dtd".length()) && (paramString.endsWith("nonvalidating/load-external-dtd")))
        return;
      if ((i == "validation/validate-datatypes".length()) && (paramString.endsWith("validation/validate-datatypes")))
      {
        s = 1;
        throw new XMLConfigurationException(s, paramString);
      }
    }
    super.checkFeature(paramString);
  }
  protected void checkProperty(String paramString)
  {
    if (paramString.startsWith("http://apache.org/xml/properties/"))
    {
      int i = paramString.length() - "http://apache.org/xml/properties/".length();
      if ((i == "internal/dtd-scanner".length()) && (paramString.endsWith("internal/dtd-scanner")))
        return;
    }
    super.checkProperty(paramString);
  }
  {
    return new XMLEntityManager();
  }
  {
    return new XMLErrorReporter();
  }
  {
    return new XMLDocumentScannerImpl();
  }
  {
    return new XMLDTDScannerImpl();
  }
  {
    return new XMLDTDProcessor();
  }
  {
    return new XMLDTDValidator();
  }
  {
    return new XMLNamespaceBinder();
  }
  {
    return DTDDVFactory.getInstance();
  }
  {
    return new ValidationManager();
  }
/* Location:           /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/thirdparty-all.jar
 * Qualified Name:     org.apache.xerces.parsers.DTDConfiguration
 * JD-Core Version:    0.6.0
 */
New to GrepCode? Check out our FAQ X