Example usage for javax.xml.transform.stax StAXSource FEATURE

List of usage examples for javax.xml.transform.stax StAXSource FEATURE

Introduction

In this page you can find the example usage for javax.xml.transform.stax StAXSource FEATURE.

Prototype

String FEATURE

To view the source code for javax.xml.transform.stax StAXSource FEATURE.

Click Source Link

Document

If javax.xml.transform.TransformerFactory#getFeature(String name) returns true when passed this value as an argument, the Transformer supports Source input of this type.

Usage

From source file:nl.nn.adapterframework.validation.xerces_2_11.XMLSchemaFactory.java

public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException(JAXPValidationMessageFormatter
                .formatMessage(fXMLSchemaLoader.getLocale(), "FeatureNameNull", null));
    }// w  ww  .j av a  2  s.c  o m
    if (name.startsWith(JAXP_SOURCE_FEATURE_PREFIX)) {
        // Indicates to the caller that this SchemaFactory supports a specific JAXP Source.
        if (name.equals(StreamSource.FEATURE) || name.equals(SAXSource.FEATURE)
                || name.equals(DOMSource.FEATURE) || name.equals(StAXSource.FEATURE)) {
            return true;
        }
    }
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        return (fSecurityManager != null);
    } else if (name.equals(USE_GRAMMAR_POOL_ONLY)) {
        return fUseGrammarPoolOnly;
    }
    try {
        return fXMLSchemaLoader.getFeature(name);
    } 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 }));
        }
    }
}

From source file:nl.nn.adapterframework.validation.xerces_2_11.XMLSchemaFactory.java

public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException(JAXPValidationMessageFormatter
                .formatMessage(fXMLSchemaLoader.getLocale(), "FeatureNameNull", null));
    }/*w  w  w . j  av  a 2  s  .  c o m*/
    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 }));
        }
    }
}