jdk.xml.internal.JdkXmlFeatures Java Examples

The following examples show how to use jdk.xml.internal.JdkXmlFeatures. 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: XMLSchemaFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public XMLSchemaFactory() {
    fErrorHandlerWrapper = new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
    fDOMEntityResolverWrapper = new DOMEntityResolverWrapper();
    fXMLGrammarPoolWrapper = new XMLGrammarPoolWrapper();
    fXMLSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, true);
    fXMLSchemaLoader.setProperty(XMLGRAMMAR_POOL, fXMLGrammarPoolWrapper);
    fXMLSchemaLoader.setEntityResolver(fDOMEntityResolverWrapper);
    fXMLSchemaLoader.setErrorHandler(fErrorHandlerWrapper);

    // Enable secure processing feature by default
    fSecurityManager = new XMLSecurityManager(true);
    fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);

    fSecurityPropertyMgr = new XMLSecurityPropertyManager();
    fXMLSchemaLoader.setProperty(XML_SECURITY_PROPERTY_MANAGER,
            fSecurityPropertyMgr);
    fXmlFeatures = new JdkXmlFeatures(fSecurityManager.isSecureProcessing());
    fOverrideDefaultParser = fXmlFeatures.getFeature(
                    JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    fXMLSchemaLoader.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser);
}
 
Example #2
Source File: XMLSchemaFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public XMLSchemaFactory() {
    fErrorHandlerWrapper = new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
    fDOMEntityResolverWrapper = new DOMEntityResolverWrapper();
    fXMLGrammarPoolWrapper = new XMLGrammarPoolWrapper();
    fXMLSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, true);
    fXMLSchemaLoader.setProperty(XMLGRAMMAR_POOL, fXMLGrammarPoolWrapper);
    fXMLSchemaLoader.setEntityResolver(fDOMEntityResolverWrapper);
    fXMLSchemaLoader.setErrorHandler(fErrorHandlerWrapper);

    // Enable secure processing feature by default
    fSecurityManager = new XMLSecurityManager(true);
    fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);

    fSecurityPropertyMgr = new XMLSecurityPropertyManager();
    fXMLSchemaLoader.setProperty(XML_SECURITY_PROPERTY_MANAGER,
            fSecurityPropertyMgr);
    fXmlFeatures = new JdkXmlFeatures(fSecurityManager.isSecureProcessing());
    fOverrideDefaultParser = fXmlFeatures.getFeature(
                    JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    fXMLSchemaLoader.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser);
}
 
Example #3
Source File: TransformerFactoryImpl.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 */
public TransformerFactoryImpl() {

    if (System.getSecurityManager() != null) {
        _isSecureMode = true;
        _isNotSecureProcessing = false;
    }

    _xmlFeatures = new JdkXmlFeatures(!_isNotSecureProcessing);
    _overrideDefaultParser = _xmlFeatures.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    _xmlSecurityPropertyMgr = new XMLSecurityPropertyManager();
    _accessExternalDTD = _xmlSecurityPropertyMgr.getValue(
            Property.ACCESS_EXTERNAL_DTD);
    _accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue(
            Property.ACCESS_EXTERNAL_STYLESHEET);

    //Parser's security manager
    _xmlSecurityManager = new XMLSecurityManager(true);
    //Unmodifiable hash map with loaded external extension functions
    _xsltcExtensionFunctions = null;
}
 
Example #4
Source File: XSLTC.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Return allowed protocols for accessing external stylesheet.
 * @param name the name of the property
 * @return the value of the property
 */
public Object getProperty(String name) {
    if (name.equals(XMLConstants.ACCESS_EXTERNAL_STYLESHEET)) {
        return _accessExternalStylesheet;
    }
    else if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
        return _accessExternalDTD;
    } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
        return _xmlSecurityManager;
    } else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) {
        return _extensionClassLoader;
    } else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) {
        return _catalogFeatures;
    } else if (JdkXmlUtils.CDATA_CHUNK_SIZE.equals(name)) {
        return _cdataChunkSize;
    }
    return null;
}
 
Example #5
Source File: XSLTC.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Set allowed protocols for accessing external stylesheet.
 * @param name the name of the property
 * @param value the value of the property
 */
public void setProperty(String name, Object value) {
    if (name.equals(XMLConstants.ACCESS_EXTERNAL_STYLESHEET)) {
        _accessExternalStylesheet = (String)value;
    }
    else if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
        _accessExternalDTD = (String)value;
    } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
        _xmlSecurityManager = (XMLSecurityManager)value;
    } else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) {
        _extensionClassLoader = (ClassLoader) value;
        /* Clear the external extension functions HashMap if extension class
           loader was changed */
        _externalExtensionFunctions.clear();
    } else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) {
        _catalogFeatures = (CatalogFeatures)value;
    } else if (JdkXmlUtils.CDATA_CHUNK_SIZE.equals(name)) {
        _cdataChunkSize = Integer.parseInt((String)value);
    }
}
 
Example #6
Source File: XMLSchemaFactory.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public XMLSchemaFactory() {
    fErrorHandlerWrapper = new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
    fDOMEntityResolverWrapper = new DOMEntityResolverWrapper();
    fXMLGrammarPoolWrapper = new XMLGrammarPoolWrapper();
    fXMLSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, true);
    fXMLSchemaLoader.setProperty(XMLGRAMMAR_POOL, fXMLGrammarPoolWrapper);
    fXMLSchemaLoader.setEntityResolver(fDOMEntityResolverWrapper);
    fXMLSchemaLoader.setErrorHandler(fErrorHandlerWrapper);

    // Enable secure processing feature by default
    fSecurityManager = new XMLSecurityManager(true);
    fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);

    fSecurityPropertyMgr = new XMLSecurityPropertyManager();
    fXMLSchemaLoader.setProperty(XML_SECURITY_PROPERTY_MANAGER,
            fSecurityPropertyMgr);
    fXmlFeatures = new JdkXmlFeatures(fSecurityManager.isSecureProcessing());
    fOverrideDefaultParser = fXmlFeatures.getFeature(
                    JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    fXMLSchemaLoader.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser);
}
 
Example #7
Source File: XSLTC.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Set allowed protocols for accessing external stylesheet.
 * @param name the name of the property
 * @param value the value of the property
 */
public void setProperty(String name, Object value) {
    if (name.equals(XMLConstants.ACCESS_EXTERNAL_STYLESHEET)) {
        _accessExternalStylesheet = (String)value;
    }
    else if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
        _accessExternalDTD = (String)value;
    } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
        _xmlSecurityManager = (XMLSecurityManager)value;
    } else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) {
        _extensionClassLoader = (ClassLoader) value;
        /* Clear the external extension functions HashMap if extension class
           loader was changed */
        _externalExtensionFunctions.clear();
    } else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) {
        _catalogFeatures = (CatalogFeatures)value;
    } else if (JdkXmlUtils.CDATA_CHUNK_SIZE.equals(name)) {
        _cdataChunkSize = Integer.parseInt((String)value);
    }
}
 
Example #8
Source File: TransformerFactoryImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 */
public TransformerFactoryImpl() {



    if (System.getSecurityManager() != null) {
        _isSecureMode = true;
        _isNotSecureProcessing = false;
    }

    _xmlFeatures = new JdkXmlFeatures(!_isNotSecureProcessing);
    _overrideDefaultParser = _xmlFeatures.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    _xmlSecurityPropertyMgr = new XMLSecurityPropertyManager();
    _accessExternalDTD = _xmlSecurityPropertyMgr.getValue(
            Property.ACCESS_EXTERNAL_DTD);
    _accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue(
            Property.ACCESS_EXTERNAL_STYLESHEET);

    //Parser's security manager
    _xmlSecurityManager = new XMLSecurityManager(true);
    //Unmodifiable hash map with loaded external extension functions
    _xsltcExtensionFunctions = null;
}
 
Example #9
Source File: XMLSchemaFactory.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public XMLSchemaFactory() {
    fErrorHandlerWrapper = new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
    fDOMEntityResolverWrapper = new DOMEntityResolverWrapper();
    fXMLGrammarPoolWrapper = new XMLGrammarPoolWrapper();
    fXMLSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, true);
    fXMLSchemaLoader.setProperty(XMLGRAMMAR_POOL, fXMLGrammarPoolWrapper);
    fXMLSchemaLoader.setEntityResolver(fDOMEntityResolverWrapper);
    fXMLSchemaLoader.setErrorHandler(fErrorHandlerWrapper);

    // Enable secure processing feature by default
    fSecurityManager = new XMLSecurityManager(true);
    fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);

    fSecurityPropertyMgr = new XMLSecurityPropertyManager();
    fXMLSchemaLoader.setProperty(XML_SECURITY_PROPERTY_MANAGER,
            fSecurityPropertyMgr);
    fXmlFeatures = new JdkXmlFeatures(fSecurityManager.isSecureProcessing());
    fOverrideDefaultParser = fXmlFeatures.getFeature(
                    JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    fXMLSchemaLoader.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser);
}
 
Example #10
Source File: TransformerFactoryImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private TransformerFactoryImpl(boolean useServicesMechanism) {
    this._useServicesMechanism = useServicesMechanism;

    if (System.getSecurityManager() != null) {
        _isSecureMode = true;
        _isNotSecureProcessing = false;
    }

    _xmlFeatures = new JdkXmlFeatures(!_isNotSecureProcessing);
    _xmlSecurityPropertyMgr = new XMLSecurityPropertyManager();
    _accessExternalDTD = _xmlSecurityPropertyMgr.getValue(
            Property.ACCESS_EXTERNAL_DTD);
    _accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue(
            Property.ACCESS_EXTERNAL_STYLESHEET);

    //Parser's security manager
    _xmlSecurityManager = new XMLSecurityManager(true);
    //Unmodifiable hash map with loaded external extension functions
    _xsltcExtensionFunctions = null;
}
 
Example #11
Source File: XSLTC.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return allowed protocols for accessing external stylesheet.
 * @param name the name of the property
 * @return the value of the property
 */
public Object getProperty(String name) {
    if (name.equals(XMLConstants.ACCESS_EXTERNAL_STYLESHEET)) {
        return _accessExternalStylesheet;
    }
    else if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
        return _accessExternalDTD;
    } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
        return _xmlSecurityManager;
    } else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) {
        return _extensionClassLoader;
    } else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) {
        return _catalogFeatures;
    } else if (JdkXmlUtils.CDATA_CHUNK_SIZE.equals(name)) {
        return _cdataChunkSize;
    }
    return null;
}
 
Example #12
Source File: TransformerFactoryImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 */
public TransformerFactoryImpl() {



    if (System.getSecurityManager() != null) {
        _isSecureMode = true;
        _isNotSecureProcessing = false;
    }

    _xmlFeatures = new JdkXmlFeatures(!_isNotSecureProcessing);
    _overrideDefaultParser = _xmlFeatures.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    _xmlSecurityPropertyMgr = new XMLSecurityPropertyManager();
    _accessExternalDTD = _xmlSecurityPropertyMgr.getValue(
            Property.ACCESS_EXTERNAL_DTD);
    _accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue(
            Property.ACCESS_EXTERNAL_STYLESHEET);

    //Parser's security manager
    _xmlSecurityManager = new XMLSecurityManager(true);
    //Unmodifiable hash map with loaded external extension functions
    _xsltcExtensionFunctions = null;
}
 
Example #13
Source File: TransformerFactoryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 */
public TransformerFactoryImpl() {



    if (System.getSecurityManager() != null) {
        _isSecureMode = true;
        _isNotSecureProcessing = false;
    }

    _xmlFeatures = new JdkXmlFeatures(!_isNotSecureProcessing);
    _overrideDefaultParser = _xmlFeatures.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    _xmlSecurityPropertyMgr = new XMLSecurityPropertyManager();
    _accessExternalDTD = _xmlSecurityPropertyMgr.getValue(
            Property.ACCESS_EXTERNAL_DTD);
    _accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue(
            Property.ACCESS_EXTERNAL_STYLESHEET);

    //Parser's security manager
    _xmlSecurityManager = new XMLSecurityManager(true);
    //Unmodifiable hash map with loaded external extension functions
    _xsltcExtensionFunctions = null;
}
 
Example #14
Source File: XPathFactoryImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * javax.xml.xpath.XPathFactory implementation.
 */

public XPathFactoryImpl() {
    if (System.getSecurityManager() != null) {
        _isSecureMode = true;
        _isNotSecureProcessing = false;
    }
    _featureManager = new JdkXmlFeatures(!_isNotSecureProcessing);
}
 
Example #15
Source File: XSLTC.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * XSLTC compiler constructor
 */
public XSLTC(JdkXmlFeatures featureManager, boolean hasListener) {
    _overrideDefaultParser = featureManager.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    _parser = new Parser(this, _overrideDefaultParser, hasListener);
    _xmlFeatures = featureManager;
    _extensionClassLoader = null;
    _externalExtensionFunctions = new HashMap<>();
}
 
Example #16
Source File: JAXPExtensionsProvider.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public JAXPExtensionsProvider(XPathFunctionResolver resolver,
    boolean featureSecureProcessing, JdkXmlFeatures featureManager ) {
    this.resolver = resolver;
    if (featureSecureProcessing &&
            !featureManager.getFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION)) {
        this.extensionInvocationDisabled = true;
    }
}
 
Example #17
Source File: XPathImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
XPathImpl(XPathVariableResolver vr, XPathFunctionResolver fr,
        boolean featureSecureProcessing, boolean useServiceMechanism,
        JdkXmlFeatures featureManager) {
    this.origVariableResolver = this.variableResolver = vr;
    this.origFunctionResolver = this.functionResolver = fr;
    this.featureSecureProcessing = featureSecureProcessing;
    this.useServiceMechanism = useServiceMechanism;
    this.featureManager = featureManager;
}
 
Example #18
Source File: XMLReaderManager.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Set property.
 */
public void setProperty(String name, Object value) {
    if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
        _accessExternalDTD = (String)value;
    } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
        _xmlSecurityManager = (XMLSecurityManager)value;
    } else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) {
        _catalogFeatures = (CatalogFeatures)value;
    } else if (JdkXmlUtils.CDATA_CHUNK_SIZE.equals(name)) {
        _cdataChunkSize = JdkXmlUtils.getValue(value, _cdataChunkSize);
    }
}
 
Example #19
Source File: TransformerImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
protected TransformerImpl(Translet translet, Properties outputProperties,
    int indentNumber, TransformerFactoryImpl tfactory)
{
    _translet = (AbstractTranslet) translet;
    if (_translet != null) {
        _translet.setMessageHandler(new MessageHandler(_errorListener));
    }
    _properties = createOutputProperties(outputProperties);
    _propertiesClone = (Properties) _properties.clone();
    _indentNumber = indentNumber;
    _tfactory = tfactory;
    _overrideDefaultParser = _tfactory.overrideDefaultParser();
    _accessExternalDTD = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD);
    _securityManager = (XMLSecurityManager)_tfactory.getAttribute(XalanConstants.SECURITY_MANAGER);
    _readerManager = XMLReaderManager.getInstance(_overrideDefaultParser);
    _readerManager.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
    _readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing);
    _readerManager.setProperty(XalanConstants.SECURITY_MANAGER, _securityManager);
    _cdataChunkSize = JdkXmlUtils.getValue(_tfactory.getAttribute(JdkXmlUtils.CDATA_CHUNK_SIZE),
            JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT);
    _readerManager.setProperty(JdkXmlUtils.CDATA_CHUNK_SIZE, _cdataChunkSize);

    _useCatalog = _tfactory.getFeature(XMLConstants.USE_CATALOG);
    if (_useCatalog) {
        _catalogFeatures = (CatalogFeatures)_tfactory.getAttribute(JdkXmlFeatures.CATALOG_FEATURES);
        String catalogFiles = _catalogFeatures.get(CatalogFeatures.Feature.DEFER);
        if (catalogFiles != null) {
            _readerManager.setFeature(XMLConstants.USE_CATALOG, _useCatalog);
            _readerManager.setProperty(JdkXmlFeatures.CATALOG_FEATURES, _catalogFeatures);
        }
    }
    //_isIncremental = tfactory._incremental;
}
 
Example #20
Source File: JAXPExtensionsProvider.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public JAXPExtensionsProvider(XPathFunctionResolver resolver,
    boolean featureSecureProcessing, JdkXmlFeatures featureManager ) {
    this.resolver = resolver;
    if (featureSecureProcessing &&
            !featureManager.getFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION)) {
        this.extensionInvocationDisabled = true;
    }
}
 
Example #21
Source File: XPathImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr,
        boolean featureSecureProcessing, JdkXmlFeatures featureManager) {
    this.origVariableResolver = this.variableResolver = vr;
    this.origFunctionResolver = this.functionResolver = fr;
    this.featureSecureProcessing = featureSecureProcessing;
    this.featureManager = featureManager;
    this.overrideDefaultParser = featureManager.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
}
 
Example #22
Source File: XPathExpressionImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
        JAXPPrefixResolver prefixResolver,XPathFunctionResolver functionResolver,
        XPathVariableResolver variableResolver, boolean featureSecureProcessing,
        JdkXmlFeatures featureManager) {
    this.xpath = xpath;
    this.prefixResolver = prefixResolver;
    this.functionResolver = functionResolver;
    this.variableResolver = variableResolver;
    this.featureSecureProcessing = featureSecureProcessing;
    this.featureManager = featureManager;
    this.overrideDefaultParser = featureManager.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
}
 
Example #23
Source File: XPathExpressionImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
        JAXPPrefixResolver prefixResolver,
        XPathFunctionResolver functionResolver,
        XPathVariableResolver variableResolver ) {
    this(xpath, prefixResolver, functionResolver, variableResolver,
            false, new JdkXmlFeatures(false));
}
 
Example #24
Source File: JAXPExtensionsProvider.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public JAXPExtensionsProvider(XPathFunctionResolver resolver,
    boolean featureSecureProcessing, JdkXmlFeatures featureManager ) {
    this.resolver = resolver;
    if (featureSecureProcessing &&
            !featureManager.getFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION)) {
        this.extensionInvocationDisabled = true;
    }
}
 
Example #25
Source File: TemplatesHandlerImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Default constructor
 */
protected TemplatesHandlerImpl(int indentNumber, TransformerFactoryImpl tfactory,
        boolean hasUserErrListener)
{
    _indentNumber = indentNumber;
    _tfactory = tfactory;

    // Instantiate XSLTC and get reference to parser object
    XSLTC xsltc = new XSLTC(tfactory.getJdkXmlFeatures(), hasUserErrListener);
    if (tfactory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING))
        xsltc.setSecureProcessing(true);

    xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET,
            (String)tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET));
    xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD,
            (String)tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD));
    xsltc.setProperty(XalanConstants.SECURITY_MANAGER,
            tfactory.getAttribute(XalanConstants.SECURITY_MANAGER));


    if ("true".equals(tfactory.getAttribute(TransformerFactoryImpl.ENABLE_INLINING)))
        xsltc.setTemplateInlining(true);
    else
        xsltc.setTemplateInlining(false);

    _useCatalog = tfactory.getFeature(XMLConstants.USE_CATALOG);
    _catalogFeatures = (CatalogFeatures)tfactory.getAttribute(JdkXmlFeatures.CATALOG_FEATURES);
    xsltc.setProperty(JdkXmlFeatures.CATALOG_FEATURES, _catalogFeatures);

    _parser = xsltc.getParser();
}
 
Example #26
Source File: XPathImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr,
        boolean featureSecureProcessing, JdkXmlFeatures featureManager) {
    this.origVariableResolver = this.variableResolver = vr;
    this.origFunctionResolver = this.functionResolver = fr;
    this.featureSecureProcessing = featureSecureProcessing;
    this.featureManager = featureManager;
    this.overrideDefaultParser = featureManager.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
}
 
Example #27
Source File: XMLReaderManager.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set property.
 */
public void setProperty(String name, Object value) {
    if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
        _accessExternalDTD = (String)value;
    } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
        _xmlSecurityManager = (XMLSecurityManager)value;
    } else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) {
        _catalogFeatures = (CatalogFeatures)value;
    } else if (JdkXmlUtils.CDATA_CHUNK_SIZE.equals(name)) {
        _cdataChunkSize = JdkXmlUtils.getValue(value, _cdataChunkSize);
    }
}
 
Example #28
Source File: XPathImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
XPathImpl(XPathVariableResolver vr, XPathFunctionResolver fr,
        boolean featureSecureProcessing, JdkXmlFeatures featureManager) {
    this.origVariableResolver = this.variableResolver = vr;
    this.origFunctionResolver = this.functionResolver = fr;
    this.featureSecureProcessing = featureSecureProcessing;
    this.featureManager = featureManager;
    overrideDefaultParser = featureManager.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);

}
 
Example #29
Source File: XPathExpressionImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
        JAXPPrefixResolver prefixResolver,XPathFunctionResolver functionResolver,
        XPathVariableResolver variableResolver, boolean featureSecureProcessing,
        JdkXmlFeatures featureManager) {
    this.xpath = xpath;
    this.prefixResolver = prefixResolver;
    this.functionResolver = functionResolver;
    this.variableResolver = variableResolver;
    this.featureSecureProcessing = featureSecureProcessing;
    this.featureManager = featureManager;
    this.overrideDefaultParser = featureManager.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
}
 
Example #30
Source File: XPathFactoryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * javax.xml.xpath.XPathFactory implementation.
 */

public XPathFactoryImpl() {
    if (System.getSecurityManager() != null) {
        _isSecureMode = true;
        _isNotSecureProcessing = false;
    }
    _featureManager = new JdkXmlFeatures(!_isNotSecureProcessing);
}