dtdconfiguration.java

来自「JAVA 所有包」· Java 代码 · 共 849 行 · 第 1/3 页

JAVA
849
字号
/* * Copyright 2001-2004 The Apache Software Foundation. *  * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *  *      http://www.apache.org/licenses/LICENSE-2.0 *  * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package com.sun.org.apache.xerces.internal.parsers;import java.io.IOException;import java.util.Locale;import com.sun.org.apache.xerces.internal.impl.Constants;import com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl;import com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl;import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;import com.sun.org.apache.xerces.internal.impl.XMLNamespaceBinder;import com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDProcessor;import com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator;import com.sun.org.apache.xerces.internal.impl.dv.DTDDVFactory;import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;import com.sun.org.apache.xerces.internal.util.SymbolTable;import com.sun.org.apache.xerces.internal.xni.XMLLocator;import com.sun.org.apache.xerces.internal.xni.XNIException;import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool;import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent;import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner;import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner;import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;/** * This is the DTD-only parser configuration.  It extends the basic * configuration with a standard set of parser components appropriate * to DTD-centric validation. Since * the Xerces2 reference implementation document and DTD scanner * implementations are capable of acting as pull parsers, this * configuration implements the  * <code>XMLPullParserConfiguration</code> interface. * <p> * In addition to the features and properties recognized by the base * parser configuration, this class recognizes these additional  * features and properties: * <ul> * <li>Features *  <ul> *   <li>http://apache.org/xml/features/validation/warn-on-duplicate-attdef</li> *   <li>http://apache.org/xml/features/validation/warn-on-undeclared-elemdef</li> *   <li>http://apache.org/xml/features/allow-java-encodings</li> *   <li>http://apache.org/xml/features/continue-after-fatal-error</li> *   <li>http://apache.org/xml/features/load-external-dtd</li> *  </ul> * <li>Properties *  <ul> *   <li>http://apache.org/xml/properties/internal/error-reporter</li> *   <li>http://apache.org/xml/properties/internal/entity-manager</li> *   <li>http://apache.org/xml/properties/internal/document-scanner</li> *   <li>http://apache.org/xml/properties/internal/dtd-scanner</li> *   <li>http://apache.org/xml/properties/internal/grammar-pool</li> *   <li>http://apache.org/xml/properties/internal/validator/dtd</li> *   <li>http://apache.org/xml/properties/internal/datatype-validator-factory</li> *  </ul> * </ul> * * @author Arnaud  Le Hors, IBM * @author Andy Clark, IBM * @author Neil Graham, IBM * * @version $Id: DTDConfiguration.java,v 1.2.6.1 2005/09/06 13:28:49 sunithareddy Exp $ */public class DTDConfiguration    extends BasicParserConfiguration     implements XMLPullParserConfiguration {    //    // Constants    //    // feature identifiers    /** Feature identifier: warn on duplicate attribute definition. */    protected static final String WARN_ON_DUPLICATE_ATTDEF =        Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ATTDEF_FEATURE;    /** Feature identifier: warn on duplicate entity definition. */    protected static final String WARN_ON_DUPLICATE_ENTITYDEF =        Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ENTITYDEF_FEATURE;        /** Feature identifier: warn on undeclared element definition. */    protected static final String WARN_ON_UNDECLARED_ELEMDEF =        Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_UNDECLARED_ELEMDEF_FEATURE;        /** Feature identifier: allow Java encodings. */    protected static final String ALLOW_JAVA_ENCODINGS =         Constants.XERCES_FEATURE_PREFIX + Constants.ALLOW_JAVA_ENCODINGS_FEATURE;        /** Feature identifier: continue after fatal error. */    protected static final String CONTINUE_AFTER_FATAL_ERROR =         Constants.XERCES_FEATURE_PREFIX + Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE;    /** Feature identifier: load external DTD. */    protected static final String LOAD_EXTERNAL_DTD =        Constants.XERCES_FEATURE_PREFIX + Constants.LOAD_EXTERNAL_DTD_FEATURE;    /** Feature identifier: notify built-in refereces. */    protected static final String NOTIFY_BUILTIN_REFS =        Constants.XERCES_FEATURE_PREFIX + Constants.NOTIFY_BUILTIN_REFS_FEATURE;        /** Feature identifier: notify character refereces. */    protected static final String NOTIFY_CHAR_REFS =        Constants.XERCES_FEATURE_PREFIX + Constants.NOTIFY_CHAR_REFS_FEATURE;        // property identifiers    /** Property identifier: error reporter. */    protected static final String ERROR_REPORTER =         Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;    /** Property identifier: entity manager. */    protected static final String ENTITY_MANAGER =         Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;        /** Property identifier document scanner: */    protected static final String DOCUMENT_SCANNER =         Constants.XERCES_PROPERTY_PREFIX + Constants.DOCUMENT_SCANNER_PROPERTY;    /** Property identifier: DTD scanner. */    protected static final String DTD_SCANNER =         Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_SCANNER_PROPERTY;    /** Property identifier: grammar pool. */    protected static final String XMLGRAMMAR_POOL =         Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY;        /** Property identifier: DTD loader. */    protected static final String DTD_PROCESSOR =         Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_PROCESSOR_PROPERTY;    /** Property identifier: DTD validator. */    protected static final String DTD_VALIDATOR =         Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_VALIDATOR_PROPERTY;    /** Property identifier: namespace binder. */    protected static final String NAMESPACE_BINDER =        Constants.XERCES_PROPERTY_PREFIX + Constants.NAMESPACE_BINDER_PROPERTY;    /** Property identifier: datatype validator factory. */    protected static final String DATATYPE_VALIDATOR_FACTORY =         Constants.XERCES_PROPERTY_PREFIX + Constants.DATATYPE_VALIDATOR_FACTORY_PROPERTY;    protected static final String VALIDATION_MANAGER =        Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY;        /** Property identifier: JAXP schema language / DOM schema-type. */    protected static final String JAXP_SCHEMA_LANGUAGE =    Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE;    /** Property identifier: JAXP schema source/ DOM schema-location. */    protected static final String JAXP_SCHEMA_SOURCE =    Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_SOURCE;    // debugging    /** Set to true and recompile to print exception stack trace. */    protected static final boolean PRINT_EXCEPTION_STACK_TRACE = false;    //    // Data    //    // components (non-configurable)    /** Grammar pool. */    protected XMLGrammarPool fGrammarPool;    /** Datatype validator factory. */    protected DTDDVFactory fDatatypeValidatorFactory;    // components (configurable)    /** Error reporter. */    protected XMLErrorReporter fErrorReporter;    /** Entity manager. */    protected XMLEntityManager fEntityManager;    /** Document scanner. */    protected XMLDocumentScanner fScanner;    /** Input Source */    protected XMLInputSource fInputSource;    /** DTD scanner. */    protected XMLDTDScanner fDTDScanner;    /** DTD Processor . */    protected XMLDTDProcessor fDTDProcessor;    /** DTD Validator. */    protected XMLDTDValidator fDTDValidator;    /** Namespace binder. */    protected XMLNamespaceBinder fNamespaceBinder;    protected ValidationManager fValidationManager;    // state    /** Locator */    protected XMLLocator fLocator;    /**      * True if a parse is in progress. This state is needed because     * some features/properties cannot be set while parsing (e.g.     * validation and namespaces).     */    protected boolean fParseInProgress = false;    //    // Constructors    //    /** Default constructor. */    public DTDConfiguration() {        this(null, null, null);    } // <init>()    /**      * Constructs a parser configuration using the specified symbol table.      *     * @param symbolTable The symbol table to use.     */    public DTDConfiguration(SymbolTable symbolTable) {        this(symbolTable, null, null);    } // <init>(SymbolTable)    /**     * Constructs a parser configuration using the specified symbol table and     * grammar pool.     * <p>     * <strong>REVISIT:</strong>      * Grammar pool will be updated when the new validation engine is     * implemented.     *     * @param symbolTable The symbol table to use.     * @param grammarPool The grammar pool to use.     */    public DTDConfiguration(SymbolTable symbolTable,                                       XMLGrammarPool grammarPool) {        this(symbolTable, grammarPool, null);    } // <init>(SymbolTable,XMLGrammarPool)    /**     * Constructs a parser configuration using the specified symbol table,     * grammar pool, and parent settings.     * <p>     * <strong>REVISIT:</strong>      * Grammar pool will be updated when the new validation engine is     * implemented.     *     * @param symbolTable    The symbol table to use.     * @param grammarPool    The grammar pool to use.     * @param parentSettings The parent settings.     */    public DTDConfiguration(SymbolTable symbolTable,                                       XMLGrammarPool grammarPool,                                       XMLComponentManager parentSettings) {        super(symbolTable, parentSettings);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?