Class XMLDTDLoader

  • All Implemented Interfaces:
    org.apache.xerces.xni.grammars.XMLGrammarLoader, org.apache.xerces.xni.parser.XMLComponent, org.apache.xerces.xni.parser.XMLDTDContentModelFilter, org.apache.xerces.xni.parser.XMLDTDContentModelSource, org.apache.xerces.xni.parser.XMLDTDFilter, org.apache.xerces.xni.parser.XMLDTDSource, org.apache.xerces.xni.XMLDTDContentModelHandler, org.apache.xerces.xni.XMLDTDHandler
    Direct Known Subclasses:
    XML11DTDProcessor

    public class XMLDTDLoader
    extends XMLDTDProcessor
    implements org.apache.xerces.xni.grammars.XMLGrammarLoader
    The DTD loader. The loader knows how to build grammars from XMLInputSources. It extends the DTD processor in order to do this; it's a separate class because DTD processors don't need to know how to talk to the outside world in their role as instance-document helpers.

    This component requires the following features and properties. It know ho to set them if no one else does:from the

    • http://xml.org/sax/features/namespaces
    • http://apache.org/xml/properties/internal/symbol-table
    • http://apache.org/xml/properties/internal/error-reporter
    • http://apache.org/xml/properties/internal/grammar-pool
    • http://apache.org/xml/properties/internal/datatype-validator-factory

    INTERNAL:

    Usage of this class is not supported. It may be altered or removed at any time.
    Version:
    $Id: XMLDTDLoader.java 1375056 2012-08-20 15:26:01Z mrglavas $
    Author:
    Neil Graham, IBM, Michael Glavassevich, IBM
    • Field Detail

      • STANDARD_URI_CONFORMANT_FEATURE

        protected static final java.lang.String STANDARD_URI_CONFORMANT_FEATURE
        Feature identifier: standard uri conformant feature.
        See Also:
        Constant Field Values
      • BALANCE_SYNTAX_TREES

        protected static final java.lang.String BALANCE_SYNTAX_TREES
        Feature identifier: balance syntax trees.
        See Also:
        Constant Field Values
      • ERROR_HANDLER

        protected static final java.lang.String ERROR_HANDLER
        Property identifier: error handler.
        See Also:
        Constant Field Values
      • ENTITY_RESOLVER

        protected static final java.lang.String ENTITY_RESOLVER
        Property identifier: entity resolver.
        See Also:
        Constant Field Values
      • LOCALE

        protected static final java.lang.String LOCALE
        Property identifier: locale.
        See Also:
        Constant Field Values
      • fEntityResolver

        protected org.apache.xerces.xni.parser.XMLEntityResolver fEntityResolver
        Entity resolver .
      • fLocale

        protected java.util.Locale fLocale
    • Constructor Detail

      • XMLDTDLoader

        public XMLDTDLoader()
        Deny default construction; we need a SymtolTable!
      • XMLDTDLoader

        public XMLDTDLoader​(SymbolTable symbolTable)
      • XMLDTDLoader

        public XMLDTDLoader​(SymbolTable symbolTable,
                            org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool)
    • Method Detail

      • getRecognizedFeatures

        public java.lang.String[] getRecognizedFeatures()
        Returns a list of feature identifiers that are recognized by this component. This method may return null if no features are recognized by this component.
        Specified by:
        getRecognizedFeatures in interface org.apache.xerces.xni.parser.XMLComponent
        Specified by:
        getRecognizedFeatures in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
        Overrides:
        getRecognizedFeatures in class XMLDTDProcessor
      • setFeature

        public void setFeature​(java.lang.String featureId,
                               boolean state)
                        throws org.apache.xerces.xni.parser.XMLConfigurationException
        Sets the state of a feature. This method is called by the component manager any time after reset when a feature changes state.

        Note: Components should silently ignore features that do not affect the operation of the component.

        Specified by:
        setFeature in interface org.apache.xerces.xni.parser.XMLComponent
        Specified by:
        setFeature in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
        Overrides:
        setFeature in class XMLDTDProcessor
        Parameters:
        featureId - The feature identifier.
        state - The state of the feature.
        Throws:
        SAXNotRecognizedException - The component should not throw this exception.
        SAXNotSupportedException - The component should not throw this exception.
        org.apache.xerces.xni.parser.XMLConfigurationException - Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.
      • getRecognizedProperties

        public java.lang.String[] getRecognizedProperties()
        Returns a list of property identifiers that are recognized by this component. This method may return null if no properties are recognized by this component.
        Specified by:
        getRecognizedProperties in interface org.apache.xerces.xni.parser.XMLComponent
        Specified by:
        getRecognizedProperties in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
        Overrides:
        getRecognizedProperties in class XMLDTDProcessor
      • getProperty

        public java.lang.Object getProperty​(java.lang.String propertyId)
                                     throws org.apache.xerces.xni.parser.XMLConfigurationException
        Returns the state of a property.
        Specified by:
        getProperty in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
        Parameters:
        propertyId - The property identifier.
        Throws:
        org.apache.xerces.xni.parser.XMLConfigurationException - Thrown on configuration error.
      • setProperty

        public void setProperty​(java.lang.String propertyId,
                                java.lang.Object value)
                         throws org.apache.xerces.xni.parser.XMLConfigurationException
        Sets the value of a property. This method is called by the component manager any time after reset when a property changes value.

        Note: Components should silently ignore properties that do not affect the operation of the component.

        Specified by:
        setProperty in interface org.apache.xerces.xni.parser.XMLComponent
        Specified by:
        setProperty in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
        Overrides:
        setProperty in class XMLDTDProcessor
        Parameters:
        propertyId - The property identifier.
        value - The value of the property.
        Throws:
        SAXNotRecognizedException - The component should not throw this exception.
        SAXNotSupportedException - The component should not throw this exception.
        org.apache.xerces.xni.parser.XMLConfigurationException - Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.
      • getFeature

        public boolean getFeature​(java.lang.String featureId)
                           throws org.apache.xerces.xni.parser.XMLConfigurationException
        Returns the state of a feature.
        Specified by:
        getFeature in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
        Parameters:
        featureId - The feature identifier.
        Throws:
        org.apache.xerces.xni.parser.XMLConfigurationException - Thrown on configuration error.
      • setLocale

        public void setLocale​(java.util.Locale locale)
        Set the locale to use for messages.
        Specified by:
        setLocale in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
        Parameters:
        locale - The locale object to use for localization of messages.
        Throws:
        org.apache.xerces.xni.XNIException - Thrown if the parser does not support the specified locale.
      • getLocale

        public java.util.Locale getLocale()
        Return the Locale the XMLGrammarLoader is using.
        Specified by:
        getLocale in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
      • setErrorHandler

        public void setErrorHandler​(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler)
        Sets the error handler.
        Specified by:
        setErrorHandler in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
        Parameters:
        errorHandler - The error handler.
      • getErrorHandler

        public org.apache.xerces.xni.parser.XMLErrorHandler getErrorHandler()
        Returns the registered error handler.
        Specified by:
        getErrorHandler in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
      • setEntityResolver

        public void setEntityResolver​(org.apache.xerces.xni.parser.XMLEntityResolver entityResolver)
        Sets the entity resolver.
        Specified by:
        setEntityResolver in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
        Parameters:
        entityResolver - The new entity resolver.
      • getEntityResolver

        public org.apache.xerces.xni.parser.XMLEntityResolver getEntityResolver()
        Returns the registered entity resolver.
        Specified by:
        getEntityResolver in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
      • loadGrammar

        public org.apache.xerces.xni.grammars.Grammar loadGrammar​(org.apache.xerces.xni.parser.XMLInputSource source)
                                                           throws java.io.IOException,
                                                                  org.apache.xerces.xni.XNIException
        Returns a Grammar object by parsing the contents of the entity pointed to by source.
        Specified by:
        loadGrammar in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
        Parameters:
        source - the location of the entity which forms the starting point of the grammar to be constructed.
        Throws:
        java.io.IOException - When a problem is encountered reading the entity XNIException When a condition arises (such as a FatalError) that requires parsing of the entity be terminated.
        org.apache.xerces.xni.XNIException
      • loadGrammarWithContext

        public void loadGrammarWithContext​(XMLDTDValidator validator,
                                           java.lang.String rootName,
                                           java.lang.String publicId,
                                           java.lang.String systemId,
                                           java.lang.String baseSystemId,
                                           java.lang.String internalSubset)
                                    throws java.io.IOException,
                                           org.apache.xerces.xni.XNIException
        Parse a DTD internal and/or external subset and insert the content into the existing DTD grammar owned by the given DTDValidator.
        Throws:
        java.io.IOException
        org.apache.xerces.xni.XNIException
      • getScannerVersion

        protected short getScannerVersion()