xml11dtdconfiguration.java
来自「JAVA 所有包」· Java 代码 · 共 1,338 行 · 第 1/4 页
JAVA
1,338 行
/* * Copyright 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.ArrayList;import java.util.HashMap;import java.util.Locale;import com.sun.org.apache.xerces.internal.impl.Constants;import com.sun.org.apache.xerces.internal.impl.XML11DTDScannerImpl;import com.sun.org.apache.xerces.internal.impl.XML11DocumentScannerImpl;import com.sun.org.apache.xerces.internal.impl.XML11NSDocumentScannerImpl;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.XMLEntityHandler;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.XMLNSDocumentScannerImpl;import com.sun.org.apache.xerces.internal.impl.XMLVersionDetector;import com.sun.org.apache.xerces.internal.impl.dtd.XML11DTDProcessor;import com.sun.org.apache.xerces.internal.impl.dtd.XML11DTDValidator;import com.sun.org.apache.xerces.internal.impl.dtd.XML11NSDTDValidator;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.dtd.XMLNSDTDValidator;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.ParserConfigurationSettings;import com.sun.org.apache.xerces.internal.util.SymbolTable;import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler;import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler;import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;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.XMLDocumentSource;import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver;import com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler;import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;/** * This class is the DTD-only parser configuration * used to parse XML 1.0 and XML 1.1 documents. * * <p> * This class recognizes the following features and properties: * <ul> * <li>Features * <ul> * <li>http://xml.org/sax/features/validation</li> * <li>http://xml.org/sax/features/namespaces</li> * <li>http://xml.org/sax/features/external-general-entities</li> * <li>http://xml.org/sax/features/external-parameter-entities</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://xml.org/sax/properties/xml-string</li> * <li>http://apache.org/xml/properties/internal/symbol-table</li> * <li>http://apache.org/xml/properties/internal/error-handler</li> * <li>http://apache.org/xml/properties/internal/entity-resolver</li> * <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 Elena Litani, IBM * @author Neil Graham, IBM * @author Michael Glavassevich, IBM * @author John Kim, IBM * * @version $Id: XML11DTDConfiguration.java,v 1.1.2.1 2005/08/01 03:37:44 jeffsuttor Exp $ */public class XML11DTDConfiguration extends ParserConfigurationSettings implements XMLPullParserConfiguration, XML11Configurable { // // Constants // protected final static String XML11_DATATYPE_VALIDATOR_FACTORY = "com.sun.org.apache.xerces.internal.impl.dv.dtd.XML11DTDDVFactoryImpl"; // feature identifiers /** Feature identifier: validation. */ protected static final String VALIDATION = Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE; /** Feature identifier: namespaces. */ protected static final String NAMESPACES = Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE; /** Feature identifier: external general entities. */ protected static final String EXTERNAL_GENERAL_ENTITIES = Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE; /** Feature identifier: external parameter entities. */ protected static final String EXTERNAL_PARAMETER_ENTITIES = Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_PARAMETER_ENTITIES_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; // property identifiers /** Property identifier: xml string. */ protected static final String XML_STRING = Constants.SAX_PROPERTY_PREFIX + Constants.XML_STRING_PROPERTY; /** Property identifier: symbol table. */ protected static final String SYMBOL_TABLE = Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY; /** Property identifier: error handler. */ protected static final String ERROR_HANDLER = Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY; /** Property identifier: entity resolver. */ protected static final String ENTITY_RESOLVER = Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY; /** 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 // protected SymbolTable fSymbolTable; protected XMLInputSource fInputSource; protected ValidationManager fValidationManager; protected XMLVersionDetector fVersionDetector; protected XMLLocator fLocator; protected Locale fLocale; /** XML 1.0 Components. */ protected ArrayList fComponents; /** XML 1.1. Components. */ protected ArrayList fXML11Components = null; /** Common components: XMLEntityManager, XMLErrorReporter */ protected ArrayList fCommonComponents = null; /** The document handler. */ protected XMLDocumentHandler fDocumentHandler; /** The DTD handler. */ protected XMLDTDHandler fDTDHandler; /** The DTD content model handler. */ protected XMLDTDContentModelHandler fDTDContentModelHandler; /** Last component in the document pipeline */ protected XMLDocumentSource fLastComponent; /** * 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; /** * fConfigUpdated is set to true if there has been any change to the configuration settings, * i.e a feature or a property was changed. */ protected boolean fConfigUpdated = false; // // XML 1.0 components // /** The XML 1.0 Datatype validator factory. */ protected DTDDVFactory fDatatypeValidatorFactory; /** The XML 1.0 Document scanner that does namespace binding. */ protected XMLNSDocumentScannerImpl fNamespaceScanner; /** The XML 1.0 Non-namespace implementation of scanner */ protected XMLDocumentScannerImpl fNonNSScanner; /** The XML 1.0 DTD Validator: binds namespaces */ protected XMLDTDValidator fDTDValidator; /** The XML 1.0 DTD Validator that does not bind namespaces */ protected XMLDTDValidator fNonNSDTDValidator; /** The XML 1.0 DTD scanner. */ protected XMLDTDScanner fDTDScanner; /** The XML 1.0 DTD Processor . */ protected XMLDTDProcessor fDTDProcessor; // // XML 1.1 components // /** The XML 1.1 datatype factory. **/ protected DTDDVFactory fXML11DatatypeFactory = null; /** The XML 1.1 document scanner that does namespace binding. **/ protected XML11NSDocumentScannerImpl fXML11NSDocScanner = null; /** The XML 1.1 document scanner that does not do namespace binding. **/ protected XML11DocumentScannerImpl fXML11DocScanner = null; /** The XML 1.1 DTD validator that does namespace binding. **/ protected XML11NSDTDValidator fXML11NSDTDValidator = null; /** The XML 1.1 DTD validator that does not do namespace binding. **/ protected XML11DTDValidator fXML11DTDValidator = null; /** The XML 1.1 DTD scanner. **/ protected XML11DTDScannerImpl fXML11DTDScanner = null; /** The XML 1.1 DTD processor. **/ protected XML11DTDProcessor fXML11DTDProcessor = null; // // Common components // /** Grammar pool. */ protected XMLGrammarPool fGrammarPool; /** Error reporter. */ protected XMLErrorReporter fErrorReporter; /** Entity manager. */ protected XMLEntityManager fEntityManager; /** Current scanner */ protected XMLDocumentScanner fCurrentScanner; /** Current Datatype validator factory. */ protected DTDDVFactory fCurrentDVFactory; /** Current DTD scanner. */ protected XMLDTDScanner fCurrentDTDScanner; /** Flag indiciating whether XML11 components have been initialized. */ private boolean f11Initialized = false; // // Constructors // /** Default constructor. */ public XML11DTDConfiguration() { this(null, null, null); } // <init>() /** * Constructs a parser configuration using the specified symbol table.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?