286N/A * reserved comment block 286N/A * DO NOT REMOVE OR ALTER! 286N/A * Copyright 2004 The Apache Software Foundation. 286N/A * Licensed under the Apache License, Version 2.0 (the "License"); 286N/A * you may not use this file except in compliance with the License. 286N/A * You may obtain a copy of the License at 286N/A * Unless required by applicable law or agreed to in writing, software 286N/A * distributed under the License is distributed on an "AS IS" BASIS, 286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 286N/A * See the License for the specific language governing permissions and 286N/A * limitations under the License. 286N/A * This class is the DTD-only parser configuration 286N/A * used to parse XML 1.0 and XML 1.1 documents. 286N/A * This class recognizes the following features and properties: 286N/A * @author Elena Litani, IBM 286N/A * @author Neil Graham, IBM 286N/A * @author Michael Glavassevich, IBM 286N/A * @author John Kim, IBM 286N/A /** Feature identifier: validation. */ 286N/A /** Feature identifier: namespaces. */ 286N/A /** Feature identifier: external general entities. */ 286N/A /** Feature identifier: external parameter entities. */ 286N/A /** Feature identifier: continue after fatal error. */ 286N/A /** Feature identifier: load external DTD. */ 286N/A // property identifiers 286N/A /** Property identifier: xml string. */ 286N/A /** Property identifier: symbol table. */ 286N/A /** Property identifier: error handler. */ 286N/A /** Property identifier: entity resolver. */ 286N/A /** Property identifier: error reporter. */ 286N/A /** Property identifier: entity manager. */ 286N/A /** Property identifier document scanner: */ 286N/A /** Property identifier: DTD scanner. */ 286N/A /** Property identifier: grammar pool. */ 286N/A /** Property identifier: DTD loader. */ 286N/A /** Property identifier: DTD validator. */ 286N/A /** Property identifier: namespace binder. */ 286N/A /** Property identifier: datatype validator factory. */ 286N/A /** Property identifier: JAXP schema language / DOM schema-type. */ 286N/A /** Property identifier: JAXP schema source/ DOM schema-location. */ 286N/A /** Set to true and recompile to print exception stack trace. */ 286N/A /** XML 1.0 Components. */ 286N/A /** XML 1.1. Components. */ 286N/A /** Common components: XMLEntityManager, XMLErrorReporter */ 286N/A /** The document handler. */ 286N/A /** The DTD handler. */ 286N/A /** The DTD content model handler. */ 286N/A /** Last component in the document pipeline */ 286N/A * True if a parse is in progress. This state is needed because 286N/A * validation and namespaces). 286N/A * fConfigUpdated is set to true if there has been any change to the configuration settings, 286N/A * i.e a feature or a property was changed. 286N/A /** The XML 1.0 Datatype validator factory. */ 286N/A /** The XML 1.0 Document scanner that does namespace binding. */ 286N/A /** The XML 1.0 Non-namespace implementation of scanner */ 286N/A /** The XML 1.0 DTD Validator: binds namespaces */ 286N/A /** The XML 1.0 DTD Validator that does not bind namespaces */ 286N/A /** The XML 1.0 DTD scanner. */ 286N/A /** The XML 1.0 DTD Processor . */ 286N/A /** The XML 1.1 datatype factory. **/ 286N/A /** The XML 1.1 document scanner that does namespace binding. **/ 286N/A /** The XML 1.1 document scanner that does not do namespace binding. **/ 286N/A /** The XML 1.1 DTD validator that does namespace binding. **/ 286N/A /** The XML 1.1 DTD validator that does not do namespace binding. **/ 286N/A /** The XML 1.1 DTD scanner. **/ 286N/A /** The XML 1.1 DTD processor. **/ 286N/A /** Current Datatype validator factory. */ 286N/A /** Current DTD scanner. */ 286N/A /** Flag indiciating whether XML11 components have been initialized. */ 286N/A /** Default constructor. */ 286N/A * Constructs a parser configuration using the specified symbol table. 286N/A * @param symbolTable The symbol table to use. 286N/A }
// <init>(SymbolTable) 286N/A * Constructs a parser configuration using the specified symbol table and 286N/A * <strong>REVISIT:</strong> 286N/A * Grammar pool will be updated when the new validation engine is 286N/A * @param symbolTable The symbol table to use. 286N/A * @param grammarPool The grammar pool to use. 286N/A }
// <init>(SymbolTable,XMLGrammarPool) 286N/A * Constructs a parser configuration using the specified symbol table, 286N/A * grammar pool, and parent settings. 286N/A * <strong>REVISIT:</strong> 286N/A * Grammar pool will be updated when the new validation engine is 286N/A * @param symbolTable The symbol table to use. 286N/A * @param grammarPool The grammar pool to use. 286N/A * @param parentSettings The parent settings. 286N/A // create a vector to hold all the components in use 286N/A // XML 1.0 specialized components 286N/A // XML 1.1 specialized components 286N/A // Common components for XML 1.1. and XML 1.0 286N/A // create table for features and properties 286N/A // add default recognized features 286N/A // set state for default features 286N/A // add default recognized properties 286N/A // add message formatters 286N/A // REVISIT: What is the right thing to do? -Ac 286N/A }
// <init>(SymbolTable,XMLGrammarPool) 286N/A * Sets the input source for the document to parse. 286N/A * @param inputSource The document's input source. 286N/A * @exception XMLConfigurationException Thrown if there is a 286N/A * configuration error when initializing the 286N/A * @exception IOException Thrown on I/O error. 286N/A // REVISIT: this method used to reset all the components and 286N/A // construct the pipeline. Now reset() is called 286N/A // in parse (boolean) just before we parse the document 286N/A // Should this method still throw exceptions..? 286N/A }
// setInputSource(XMLInputSource) 286N/A * Set the locale to use for messages. 286N/A * @param locale The locale object to use for localization of messages. 286N/A * @exception XNIException Thrown if the parser does not support the 286N/A * Sets the document handler on the last component in the pipeline 286N/A * to receive information about the document. 286N/A * @param documentHandler The document handler. 286N/A }
// setDocumentHandler(XMLDocumentHandler) 286N/A /** Returns the registered document handler. */ 286N/A }
// getDocumentHandler():XMLDocumentHandler 286N/A * Sets the DTD handler. 286N/A * @param dtdHandler The DTD handler. 286N/A }
// setDTDHandler(XMLDTDHandler) 286N/A /** Returns the registered DTD handler. */ 286N/A }
// getDTDHandler():XMLDTDHandler 286N/A * Sets the DTD content model handler. 286N/A * @param handler The DTD content model handler. 286N/A }
// setDTDContentModelHandler(XMLDTDContentModelHandler) 286N/A /** Returns the registered DTD content model handler. */ 286N/A }
// getDTDContentModelHandler():XMLDTDContentModelHandler 286N/A * Sets the resolver used to resolve external entities. The EntityResolver 286N/A * interface supports resolution of public and system identifiers. 286N/A * @param resolver The new entity resolver. Passing a null value will 286N/A * uninstall the currently installed resolver. 286N/A }
// setEntityResolver(XMLEntityResolver) 286N/A * Return the current entity resolver. 286N/A * @return The current entity resolver, or null if none 286N/A * @see #setEntityResolver 286N/A }
// getEntityResolver():XMLEntityResolver 286N/A * Allow an application to register an error event handler. 286N/A * <p>If the application does not register an error handler, all 286N/A * error events reported by the SAX parser will be silently 286N/A * ignored; however, normal processing may not continue. It is 286N/A * highly recommended that all SAX applications implement an 286N/A * error handler to avoid unexpected bugs.</p> 286N/A * <p>Applications may register a new or different handler in the 286N/A * middle of a parse, and the SAX parser must begin using the new 286N/A * handler immediately.</p> 286N/A * @param errorHandler The error handler. 286N/A * @exception java.lang.NullPointerException If the handler 286N/A * @see #getErrorHandler 286N/A }
// setErrorHandler(XMLErrorHandler) 286N/A * Return the current error handler. 286N/A * @return The current error handler, or null if none 286N/A * @see #setErrorHandler 286N/A // REVISIT: Should this be a property? 286N/A }
// getErrorHandler():XMLErrorHandler 286N/A * If the application decides to terminate parsing before the xml document 286N/A * is fully parsed, the application should call this method to free any 286N/A * resource allocated during parsing. For example, close all opened streams. 286N/A * Parses the specified input source. 286N/A * @param source The input source. 286N/A * @exception XNIException Throws exception on XNI error. 286N/A * @exception java.io.IOException Throws exception on i/o error. 286N/A // REVISIT - need to add new error message 286N/A // close all streams opened by xerces 286N/A }
// parse(InputSource) 286N/A // reset and configure pipeline and set InputSource. 286N/A // mark configuration as fixed 286N/A // resets and sets the pipeline. 286N/A }
// parse(boolean):boolean 286N/A * Returns the state of a feature. 286N/A * @param featureId The feature identifier. 286N/A * @return true if the feature is supported 286N/A * @throws XMLConfigurationException Thrown for configuration error. 286N/A * In general, components should 286N/A * only throw this exception if 286N/A * it is <strong>really</strong> 286N/A // make this feature special 286N/A }
// getFeature(String):boolean 286N/A * Set the state of a feature. 286N/A * Set the state of any feature in a SAX2 parser. The parser 286N/A * might not recognize the feature, and if it does recognize 286N/A * it, it might not be able to fulfill the request. 286N/A * @param featureId The unique identifier (URI) of the feature. 286N/A * @param state The requested state of the feature (true or false). 286N/A * @exception com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException If the 286N/A * requested feature is not known. 286N/A // forward to every XML 1.0 component 286N/A // forward it to common components 286N/A // forward to every XML 1.1 component 286N/A // save state if noone "objects" 286N/A }
// setFeature(String,boolean) 286N/A // forward to every XML 1.0 component 286N/A // forward it to every common Component 286N/A // forward it to every XML 1.1 component 286N/A // store value if noone "objects" 286N/A }
// setProperty(String,Object) 286N/A /** Returns the locale. */ 286N/A }
// getLocale():Locale 286N/A * reset all XML 1.0 components before parsing and namespace context 286N/A * reset all common components before parsing 286N/A // reset common components 286N/A * reset all components before parsing and namespace context 286N/A // reset every component 286N/A * Configures the XML 1.1 pipeline. 286N/A * Note: this method also resets the new XML11 components. 286N/A // setup XML 1.1 document pipeline 286N/A // non namespace document pipeline 286N/A }
// configureXML11Pipeline() 286N/A /** Configures the pipeline. */ 286N/A // use XML 1.0 datatype library 286N/A // setup document pipeline 286N/A }
// configurePipeline() 286N/A // features and properties 286N/A * Check a feature. If feature is know and supported, this method simply 286N/A * returns. Otherwise, the appropriate exception is thrown. 286N/A * @param featureId The unique identifier (URI) of the feature. 286N/A * @throws XMLConfigurationException Thrown for configuration error. 286N/A * In general, components should 286N/A * only throw this exception if 286N/A * it is <strong>really</strong> 286N/A // Allows the parser to validate a document only when it 286N/A // contains a grammar. Validation is turned on/off based 286N/A // on each document instance, automatically. 286N/A // special performance feature: only component manager is allowed to set it. 286N/A }
// checkFeature(String) 286N/A * Check a property. If the property is know and supported, this method 286N/A * simply returns. Otherwise, the appropriate exception is thrown. 286N/A * @param propertyId The unique identifier (URI) of the property 286N/A * @throws XMLConfigurationException Thrown for configuration error. 286N/A * In general, components should 286N/A * only throw this exception if 286N/A * it is <strong>really</strong> 286N/A // Get the literal string of characters associated with the 286N/A // current event. If the parser recognises and supports this 286N/A // property but is not currently parsing text, it should return 286N/A // null (this is a good way to check for availability before the 286N/A // REVISIT - we should probably ask xml-dev for a precise 286N/A // definition of what this is actually supposed to return, and 286N/A // in exactly which circumstances. 286N/A }
// checkProperty(String) 286N/A * Adds a component to the parser configuration. This method will 286N/A * also add all of the component's recognized features and properties 286N/A * to the list of default recognized features and properties. 286N/A * @param component The component to add. 286N/A // don't add a component more than once 286N/A }
// addComponent(XMLComponent) 286N/A * Adds common component to the parser configuration. This method will 286N/A * also add all of the component's recognized features and properties 286N/A * to the list of default recognized features and properties. 286N/A * @param component The component to add. 286N/A // don't add a component more than once 286N/A }
// addCommonComponent(XMLComponent) 286N/A * Adds an XML 1.1 component to the parser configuration. This method will 286N/A * also add all of the component's recognized features and properties 286N/A * to the list of default recognized features and properties. 286N/A * @param component The component to add. 286N/A // don't add a component more than once 286N/A }
// addXML11Component(XMLComponent) 286N/A * Adds all of the component's recognized features and properties 286N/A * to the list of default recognized features and properties, and 286N/A * sets default values on the configuration for features and 286N/A * properties which were previously absent from the configuration. 286N/A * @param component The component whose recognized features 286N/A * and properties will be added to the configuration 286N/A // register component's recognized features 286N/A // register component's recognized properties 286N/A // Do not overwrite values already set on the configuration. 286N/A // For newly added components who recognize this feature 286N/A // but did not offer a default value, we need to make 286N/A // sure these components will get an opportunity to read 286N/A // the value before parsing begins. 286N/A // Do not overwrite values already set on the configuration. 286N/A // For newly added components who recognize this property 286N/A // but did not offer a default value, we need to make 286N/A // sure these components will get an opportunity to read 286N/A // the value before parsing begins. 286N/A // create datatype factory 286N/A // setup XML 1.1 DTD pipeline 286N/A // setup XML 1.1. document pipeline - namespace aware 286N/A}
// class XML11DTDConfiguration