Java Code Examples for com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager#getFeature()

The following examples show how to use com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager#getFeature() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XIncludeHandler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void copyFeatures1(
    Enumeration features,
    String featurePrefix,
    XMLComponentManager from,
    XMLParserConfiguration to) {
    while (features.hasMoreElements()) {
        String featureId = featurePrefix + (String)features.nextElement();
        boolean value = from.getFeature(featureId);

        try {
            to.setFeature(featureId, value);
        }
        catch (XMLConfigurationException e) {
            // componentManager doesn't support this feature,
            // so we won't worry about it
        }
    }
}
 
Example 2
Source File: XIncludeHandler.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private void copyFeatures1(
    Enumeration features,
    String featurePrefix,
    XMLComponentManager from,
    XMLParserConfiguration to) {
    while (features.hasMoreElements()) {
        String featureId = featurePrefix + (String)features.nextElement();
        boolean value = from.getFeature(featureId);

        try {
            to.setFeature(featureId, value);
        }
        catch (XMLConfigurationException e) {
            // componentManager doesn't support this feature,
            // so we won't worry about it
        }
    }
}
 
Example 3
Source File: DTDGrammarUtil.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void reset(XMLComponentManager componentManager)
throws XMLConfigurationException {

    fDTDGrammar = null;
    fInElementContent = false;
    fCurrentElementIndex = -1;
    fCurrentContentSpecType = -1;
    fNamespaces = componentManager.getFeature(NAMESPACES, true);
    fSymbolTable = (SymbolTable) componentManager.getProperty(
            Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY);
    fElementDepth = -1;
}
 
Example 4
Source File: XMLScanner.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Throws exception if required features and
 *                      properties cannot be found.
 */
public void reset(XMLComponentManager componentManager)
throws XMLConfigurationException {

            fParserSettings = componentManager.getFeature(PARSER_SETTINGS, true);

            if (!fParserSettings) {
                    // parser settings have not been changed
                    init();
                    return;
            }


    // Xerces properties
    fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE);
    fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
    fEntityManager = (XMLEntityManager)componentManager.getProperty(ENTITY_MANAGER);
    fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER);

    //this step is extra because we have separated the storage of entity
    fEntityStore = fEntityManager.getEntityStore() ;

    // sax features
    fValidation = componentManager.getFeature(VALIDATION, false);
    fNamespaces = componentManager.getFeature(NAMESPACES, true);
    fNotifyCharRefs = componentManager.getFeature(NOTIFY_CHAR_REFS, false);

    init();
}
 
Example 5
Source File: XMLScanner.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 *
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Throws exception if required features and
 *                      properties cannot be found.
 */
public void reset(XMLComponentManager componentManager)
throws XMLConfigurationException {

            fParserSettings = componentManager.getFeature(PARSER_SETTINGS, true);

            if (!fParserSettings) {
                    // parser settings have not been changed
                    init();
                    return;
            }


    // Xerces properties
    fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE);
    fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
    fEntityManager = (XMLEntityManager)componentManager.getProperty(ENTITY_MANAGER);
    fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER);

    //this step is extra because we have separated the storage of entity
    fEntityStore = fEntityManager.getEntityStore() ;

    // sax features
    fValidation = componentManager.getFeature(VALIDATION, false);
    fNamespaces = componentManager.getFeature(NAMESPACES, true);
    fNotifyCharRefs = componentManager.getFeature(NOTIFY_CHAR_REFS, false);

    init();
}
 
Example 6
Source File: DTDGrammarUtil.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void reset(XMLComponentManager componentManager)
throws XMLConfigurationException {

    fDTDGrammar = null;
    fInElementContent = false;
    fCurrentElementIndex = -1;
    fCurrentContentSpecType = -1;
    fNamespaces = componentManager.getFeature(NAMESPACES, true);
    fSymbolTable = (SymbolTable) componentManager.getProperty(
            Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY);
    fElementDepth = -1;
}
 
Example 7
Source File: XMLDocumentFragmentScannerImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Resets the component. The component can query the component manager
 * about any features and properties that affect the operation of the
 * component.
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Thrown by component on initialization error.
 *                      For example, if a feature or property is
 *                      required for the operation of the component, the
 *                      component manager may throw a
 *                      SAXNotRecognizedException or a
 *                      SAXNotSupportedException.
 */

public void reset(XMLComponentManager componentManager)
throws XMLConfigurationException {

    super.reset(componentManager);

    // other settings
    // fDocumentSystemId = null;

    // sax features
    //fAttributes.setNamespaces(fNamespaces);

    // xerces features
    fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT, true);
    fSecurityManager = (XMLSecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null);
    fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS, false);

    Object resolver = componentManager.getProperty(ENTITY_RESOLVER, null);
    fExternalSubsetResolver = (resolver instanceof ExternalSubsetResolver) ?
            (ExternalSubsetResolver) resolver : null;

    //attribute
    fReadingAttributes = false;
    //xxx: external entities are supported in Xerces
    // it would be good to define feature for this case
    fSupportExternalEntities = true;
    fReplaceEntityReferences = true;
    fIsCoalesce = false;

    // setup Driver
    setScannerState(SCANNER_STATE_CONTENT);
    setDriver(fContentDriver);

    // JAXP 1.5 features and properties
    XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)
            componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER, null);
    fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);

    fStrictURI = componentManager.getFeature(STANDARD_URI_CONFORMANT, false);

    resetCommon();
    //fEntityManager.test();
}
 
Example 8
Source File: XMLDocumentFragmentScannerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Resets the component. The component can query the component manager
 * about any features and properties that affect the operation of the
 * component.
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Thrown by component on initialization error.
 *                      For example, if a feature or property is
 *                      required for the operation of the component, the
 *                      component manager may throw a
 *                      SAXNotRecognizedException or a
 *                      SAXNotSupportedException.
 */

public void reset(XMLComponentManager componentManager)
throws XMLConfigurationException {

    super.reset(componentManager);

    // other settings
    // fDocumentSystemId = null;

    // sax features
    //fAttributes.setNamespaces(fNamespaces);

    // xerces features
    fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT, true);
    fSecurityManager = (XMLSecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null);
    fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS, false);

    Object resolver = componentManager.getProperty(ENTITY_RESOLVER, null);
    fExternalSubsetResolver = (resolver instanceof ExternalSubsetResolver) ?
            (ExternalSubsetResolver) resolver : null;

    //attribute
    fReadingAttributes = false;
    //xxx: external entities are supported in Xerces
    // it would be good to define feature for this case
    fSupportExternalEntities = true;
    fReplaceEntityReferences = true;
    fIsCoalesce = false;

    // setup Driver
    setScannerState(SCANNER_STATE_CONTENT);
    setDriver(fContentDriver);

    // JAXP 1.5 features and properties
    XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)
            componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER, null);
    fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);

    fStrictURI = componentManager.getFeature(STANDARD_URI_CONFORMANT, false);

    resetCommon();
    //fEntityManager.test();
}
 
Example 9
Source File: XMLDTDProcessor.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public void reset(XMLComponentManager componentManager) throws XMLConfigurationException {

        boolean parser_settings = componentManager.getFeature(PARSER_SETTINGS, true);

        if (!parser_settings) {
            // parser settings have not been changed
            reset();
            return;
        }

        // sax features
        fValidation = componentManager.getFeature(VALIDATION, false);

        fDTDValidation =
                !(componentManager
                    .getFeature(
                        Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_VALIDATION_FEATURE, false));

        // Xerces features

        fWarnDuplicateAttdef = componentManager.getFeature(WARN_ON_DUPLICATE_ATTDEF, false);
        fWarnOnUndeclaredElemdef = componentManager.getFeature(WARN_ON_UNDECLARED_ELEMDEF, false);

        // get needed components
        fErrorReporter =
            (XMLErrorReporter) componentManager.getProperty(
                Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY);
        fSymbolTable =
            (SymbolTable) componentManager.getProperty(
                Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY);

        fGrammarPool = (XMLGrammarPool) componentManager.getProperty(GRAMMAR_POOL, null);

        try {
            fValidator = (XMLDTDValidator) componentManager.getProperty(DTD_VALIDATOR, null);
        } catch (ClassCastException e) {
            fValidator = null;
        }
        // we get our grammarBucket from the validator...
        if (fValidator != null) {
            fGrammarBucket = fValidator.getGrammarBucket();
        } else {
            fGrammarBucket = null;
        }
        reset();

    }
 
Example 10
Source File: XMLDocumentFragmentScannerImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Resets the component. The component can query the component manager
 * about any features and properties that affect the operation of the
 * component.
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Thrown by component on initialization error.
 *                      For example, if a feature or property is
 *                      required for the operation of the component, the
 *                      component manager may throw a
 *                      SAXNotRecognizedException or a
 *                      SAXNotSupportedException.
 */

public void reset(XMLComponentManager componentManager)
throws XMLConfigurationException {

    super.reset(componentManager);

    // other settings
    // fDocumentSystemId = null;

    // sax features
    //fAttributes.setNamespaces(fNamespaces);

    // xerces features
    fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT, true);
    fSecurityManager = (XMLSecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null);
    fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS, false);

    Object resolver = componentManager.getProperty(ENTITY_RESOLVER, null);
    fExternalSubsetResolver = (resolver instanceof ExternalSubsetResolver) ?
            (ExternalSubsetResolver) resolver : null;

    //attribute
    fReadingAttributes = false;
    //xxx: external entities are supported in Xerces
    // it would be good to define feature for this case
    fSupportExternalEntities = true;
    fReplaceEntityReferences = true;
    fIsCoalesce = false;

    // setup Driver
    setScannerState(SCANNER_STATE_CONTENT);
    setDriver(fContentDriver);

    // JAXP 1.5 features and properties
    XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)
            componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER, null);
    fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);

    fStrictURI = componentManager.getFeature(STANDARD_URI_CONFORMANT, false);

    resetCommon();
    //fEntityManager.test();
}
 
Example 11
Source File: XMLDocumentFragmentScannerImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Resets the component. The component can query the component manager
 * about any features and properties that affect the operation of the
 * component.
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Thrown by component on initialization error.
 *                      For example, if a feature or property is
 *                      required for the operation of the component, the
 *                      component manager may throw a
 *                      SAXNotRecognizedException or a
 *                      SAXNotSupportedException.
 */

public void reset(XMLComponentManager componentManager)
throws XMLConfigurationException {

    super.reset(componentManager);

    // other settings
    // fDocumentSystemId = null;

    // sax features
    //fAttributes.setNamespaces(fNamespaces);

    // xerces features
    fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT, true);
    fSecurityManager = (XMLSecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null);
    fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS, false);

    Object resolver = componentManager.getProperty(ENTITY_RESOLVER, null);
    fExternalSubsetResolver = (resolver instanceof ExternalSubsetResolver) ?
            (ExternalSubsetResolver) resolver : null;

    //attribute
    fReadingAttributes = false;
    //xxx: external entities are supported in Xerces
    // it would be good to define feature for this case
    fSupportExternalEntities = true;
    fReplaceEntityReferences = true;
    fIsCoalesce = false;

    // setup Driver
    setScannerState(SCANNER_STATE_CONTENT);
    setDriver(fContentDriver);

    // JAXP 1.5 features and properties
    XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)
            componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER, null);
    fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);

    fStrictURI = componentManager.getFeature(STANDARD_URI_CONFORMANT, false);

    resetCommon();
    //fEntityManager.test();
}
 
Example 12
Source File: XMLErrorReporter.java    From JDKSourceCode1.8 with MIT License 3 votes vote down vote up
/**
 * Resets the component. The component can query the component manager
 * about any features and properties that affect the operation of the
 * component.
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Thrown by component on initialization error.
 *                      For example, if a feature or property is
 *                      required for the operation of the component, the
 *                      component manager may throw a
 *                      SAXNotRecognizedException or a
 *                      SAXNotSupportedException.
 */
public void reset(XMLComponentManager componentManager)
    throws XNIException {

    // features
    fContinueAfterFatalError = componentManager.getFeature(CONTINUE_AFTER_FATAL_ERROR, false);

    // properties
    fErrorHandler = (XMLErrorHandler)componentManager.getProperty(ERROR_HANDLER);

}
 
Example 13
Source File: XMLNamespaceBinder.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Resets the component. The component can query the component manager
 * about any features and properties that affect the operation of the
 * component.
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Thrown by component on initialization error.
 *                      For example, if a feature or property is
 *                      required for the operation of the component, the
 *                      component manager may throw a
 *                      SAXNotRecognizedException or a
 *                      SAXNotSupportedException.
 */
public void reset(XMLComponentManager componentManager)
    throws XNIException {

    // features
    fNamespaces = componentManager.getFeature(NAMESPACES, true);

    // Xerces properties
    fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE);
    fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);

}
 
Example 14
Source File: XMLEntityStorage.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Resets the component. The component can query the component manager
 * about any features and properties that affect the operation of the
 * component.
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Thrown by component on initialization error.
 *                      For example, if a feature or property is
 *                      required for the operation of the component, the
 *                      component manager may throw a
 *                      SAXNotRecognizedException or a
 *                      SAXNotSupportedException.
 */
public void reset(XMLComponentManager componentManager)
throws XMLConfigurationException {


    // xerces features

    fWarnDuplicateEntityDef = componentManager.getFeature(WARN_ON_DUPLICATE_ENTITYDEF, false);

    fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);

    fEntities.clear();
    fCurrentEntity = null;

}
 
Example 15
Source File: XMLNamespaceBinder.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Resets the component. The component can query the component manager
 * about any features and properties that affect the operation of the
 * component.
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Thrown by component on initialization error.
 *                      For example, if a feature or property is
 *                      required for the operation of the component, the
 *                      component manager may throw a
 *                      SAXNotRecognizedException or a
 *                      SAXNotSupportedException.
 */
public void reset(XMLComponentManager componentManager)
    throws XNIException {

    // features
    fNamespaces = componentManager.getFeature(NAMESPACES, true);

    // Xerces properties
    fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE);
    fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);

}
 
Example 16
Source File: XMLEntityScanner.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Resets the component. The component can query the component manager
 * about any features and properties that affect the operation of the
 * component.
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Thrown by component on initialization error.
 *                      For example, if a feature or property is
 *                      required for the operation of the component, the
 *                      component manager may throw a
 *                      SAXNotRecognizedException or a
 *                      SAXNotSupportedException.
 */
public void reset(XMLComponentManager componentManager)
throws XMLConfigurationException {
    // xerces features
    fAllowJavaEncodings = componentManager.getFeature(ALLOW_JAVA_ENCODINGS, false);

    //xerces properties
    fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE);
    fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
    resetCommon();
}
 
Example 17
Source File: XMLNamespaceBinder.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Resets the component. The component can query the component manager
 * about any features and properties that affect the operation of the
 * component.
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Thrown by component on initialization error.
 *                      For example, if a feature or property is
 *                      required for the operation of the component, the
 *                      component manager may throw a
 *                      SAXNotRecognizedException or a
 *                      SAXNotSupportedException.
 */
public void reset(XMLComponentManager componentManager)
    throws XNIException {

    // features
    fNamespaces = componentManager.getFeature(NAMESPACES, true);

    // Xerces properties
    fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE);
    fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);

}
 
Example 18
Source File: XMLErrorReporter.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * Resets the component. The component can query the component manager
 * about any features and properties that affect the operation of the
 * component.
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Thrown by component on initialization error.
 *                      For example, if a feature or property is
 *                      required for the operation of the component, the
 *                      component manager may throw a
 *                      SAXNotRecognizedException or a
 *                      SAXNotSupportedException.
 */
public void reset(XMLComponentManager componentManager)
    throws XNIException {

    // features
    fContinueAfterFatalError = componentManager.getFeature(CONTINUE_AFTER_FATAL_ERROR, false);

    // properties
    fErrorHandler = (XMLErrorHandler)componentManager.getProperty(ERROR_HANDLER);

}
 
Example 19
Source File: XMLEntityScanner.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * Resets the component. The component can query the component manager
 * about any features and properties that affect the operation of the
 * component.
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Thrown by component on initialization error.
 *                      For example, if a feature or property is
 *                      required for the operation of the component, the
 *                      component manager may throw a
 *                      SAXNotRecognizedException or a
 *                      SAXNotSupportedException.
 */
public void reset(XMLComponentManager componentManager)
throws XMLConfigurationException {
    // xerces features
    fAllowJavaEncodings = componentManager.getFeature(ALLOW_JAVA_ENCODINGS, false);

    //xerces properties
    fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE);
    fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
    resetCommon();
}
 
Example 20
Source File: XMLNamespaceBinder.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * Resets the component. The component can query the component manager
 * about any features and properties that affect the operation of the
 * component.
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Thrown by component on initialization error.
 *                      For example, if a feature or property is
 *                      required for the operation of the component, the
 *                      component manager may throw a
 *                      SAXNotRecognizedException or a
 *                      SAXNotSupportedException.
 */
public void reset(XMLComponentManager componentManager)
    throws XNIException {

    // features
    fNamespaces = componentManager.getFeature(NAMESPACES, true);

    // Xerces properties
    fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE);
    fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);

}