Search in sources :

Example 1 with XMLConfigurationException

use of org.apache.xerces.xni.parser.XMLConfigurationException in project iaf by ibissource.

the class XMLSchemaFactory method setProperty.

public void setProperty(String name, Object object) throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "ProperyNameNull", null));
    }
    if (name.equals(SECURITY_MANAGER)) {
        fSecurityManager = (SecurityManager) object;
        fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
        return;
    } else if (name.equals(XMLGRAMMAR_POOL)) {
        throw new SAXNotSupportedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "property-not-supported", new Object[] { name }));
    }
    try {
        fXMLSchemaLoader.setProperty(name, object);
    } catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "property-not-recognized", new Object[] { identifier }));
        } else {
            throw new SAXNotSupportedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "property-not-supported", new Object[] { identifier }));
        }
    }
}
Also used : SAXNotSupportedException(org.xml.sax.SAXNotSupportedException) XMLConfigurationException(org.apache.xerces.xni.parser.XMLConfigurationException) SAXNotRecognizedException(org.xml.sax.SAXNotRecognizedException)

Example 2 with XMLConfigurationException

use of org.apache.xerces.xni.parser.XMLConfigurationException in project iaf by ibissource.

the class XMLSchemaValidatorComponentManager method setFeature.

/**
 * Set the state of a feature.
 *
 * @param featureId The unique identifier (URI) of the feature.
 * @param state The requested state of the feature (true or false).
 *
 * @exception XMLConfigurationException If the requested feature is not known.
 */
public void setFeature(String featureId, boolean value) throws XMLConfigurationException {
    if (PARSER_SETTINGS.equals(featureId)) {
        throw new XMLConfigurationException(XMLConfigurationException.NOT_SUPPORTED, featureId);
    } else if (value == false && (VALIDATION.equals(featureId) || SCHEMA_VALIDATION.equals(featureId))) {
        throw new XMLConfigurationException(XMLConfigurationException.NOT_SUPPORTED, featureId);
    } else if (USE_GRAMMAR_POOL_ONLY.equals(featureId) && value != fUseGrammarPoolOnly) {
        throw new XMLConfigurationException(XMLConfigurationException.NOT_SUPPORTED, featureId);
    }
    if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
        setProperty(SECURITY_MANAGER, value ? new SecurityManager() : null);
        return;
    }
    fConfigUpdated = true;
    fEntityManager.setFeature(featureId, value);
    fErrorReporter.setFeature(featureId, value);
    fSchemaValidator.setFeature(featureId, value);
    if (!fInitFeatures.containsKey(featureId)) {
        boolean current = super.getFeature(featureId);
        fInitFeatures.put(featureId, current ? Boolean.TRUE : Boolean.FALSE);
    }
    super.setFeature(featureId, value);
}
Also used : SecurityManager(org.apache.xerces.util.SecurityManager) XMLConfigurationException(org.apache.xerces.xni.parser.XMLConfigurationException)

Example 3 with XMLConfigurationException

use of org.apache.xerces.xni.parser.XMLConfigurationException in project iaf by ibissource.

the class XMLSchemaFactory method setFeature.

public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "FeatureNameNull", null));
    }
    if (name.startsWith(JAXP_SOURCE_FEATURE_PREFIX)) {
        if (name.equals(StreamSource.FEATURE) || name.equals(SAXSource.FEATURE) || name.equals(DOMSource.FEATURE) || name.equals(StAXSource.FEATURE)) {
            throw new SAXNotSupportedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "feature-read-only", new Object[] { name }));
        }
    }
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        fSecurityManager = value ? new SecurityManager() : null;
        fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
        return;
    } else if (name.equals(USE_GRAMMAR_POOL_ONLY)) {
        fUseGrammarPoolOnly = value;
        return;
    }
    try {
        fXMLSchemaLoader.setFeature(name, value);
    } catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "feature-not-recognized", new Object[] { identifier }));
        } else {
            throw new SAXNotSupportedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "feature-not-supported", new Object[] { identifier }));
        }
    }
}
Also used : SAXNotSupportedException(org.xml.sax.SAXNotSupportedException) SecurityManager(org.apache.xerces.util.SecurityManager) XMLConfigurationException(org.apache.xerces.xni.parser.XMLConfigurationException) SAXNotRecognizedException(org.xml.sax.SAXNotRecognizedException)

Aggregations

XMLConfigurationException (org.apache.xerces.xni.parser.XMLConfigurationException)3 SecurityManager (org.apache.xerces.util.SecurityManager)2 SAXNotRecognizedException (org.xml.sax.SAXNotRecognizedException)2 SAXNotSupportedException (org.xml.sax.SAXNotSupportedException)2