Java Code Examples for com.sun.org.apache.xalan.internal.XalanConstants#JDK_ENTITY_COUNT_INFO

The following examples show how to use com.sun.org.apache.xalan.internal.XalanConstants#JDK_ENTITY_COUNT_INFO . 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: Parser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses a stylesheet and builds the internal abstract syntax tree
 * @param input A SAX2 InputSource can be passed to a SAX reader
 * @return The root of the abstract syntax tree
 */
public SyntaxTreeNode parse(InputSource input) {
    final XMLReader reader = JdkXmlUtils.getXMLReader(_overrideDefaultParser,
            _xsltc.isSecureProcessing());

    JdkXmlUtils.setXMLReaderPropertyIfSupport(reader, XMLConstants.ACCESS_EXTERNAL_DTD,
            _xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD), true);

    String lastProperty = "";
    try {
        XMLSecurityManager securityManager =
                (XMLSecurityManager) _xsltc.getProperty(XalanConstants.SECURITY_MANAGER);
        for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
            lastProperty = limit.apiProperty();
            reader.setProperty(lastProperty, securityManager.getLimitValueAsString(limit));
        }
        if (securityManager.printEntityCountInfo()) {
            lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO;
            reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
        }
    } catch (SAXException se) {
        XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se);
    }

    return (parse(reader, input));
}
 
Example 2
Source File: Parser.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Parses a stylesheet and builds the internal abstract syntax tree
 * @param input A SAX2 InputSource can be passed to a SAX reader
 * @return The root of the abstract syntax tree
 */
public SyntaxTreeNode parse(InputSource input) {
    final XMLReader reader = JdkXmlUtils.getXMLReader(_overrideDefaultParser,
            _xsltc.isSecureProcessing());

    JdkXmlUtils.setXMLReaderPropertyIfSupport(reader, XMLConstants.ACCESS_EXTERNAL_DTD,
            _xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD), true);

    String lastProperty = "";
    try {
        XMLSecurityManager securityManager =
                (XMLSecurityManager) _xsltc.getProperty(XalanConstants.SECURITY_MANAGER);
        for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
            lastProperty = limit.apiProperty();
            reader.setProperty(lastProperty, securityManager.getLimitValueAsString(limit));
        }
        if (securityManager.printEntityCountInfo()) {
            lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO;
            reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
        }
    } catch (SAXException se) {
        XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se);
    }

    return (parse(reader, input));
}
 
Example 3
Source File: Parser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses a stylesheet and builds the internal abstract syntax tree
 * @param input A SAX2 InputSource can be passed to a SAX reader
 * @return The root of the abstract syntax tree
 */
public SyntaxTreeNode parse(InputSource input) {
    final XMLReader reader = JdkXmlUtils.getXMLReader(_overrideDefaultParser,
            _xsltc.isSecureProcessing());

    JdkXmlUtils.setXMLReaderPropertyIfSupport(reader, XMLConstants.ACCESS_EXTERNAL_DTD,
            _xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD), true);

    String lastProperty = "";
    try {
        XMLSecurityManager securityManager =
                (XMLSecurityManager) _xsltc.getProperty(XalanConstants.SECURITY_MANAGER);
        for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
            lastProperty = limit.apiProperty();
            reader.setProperty(lastProperty, securityManager.getLimitValueAsString(limit));
        }
        if (securityManager.printEntityCountInfo()) {
            lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO;
            reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
        }
    } catch (SAXException se) {
        XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se);
    }

    return (parse(reader, input));
}
 
Example 4
Source File: Parser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses a stylesheet and builds the internal abstract syntax tree
 * @param input A SAX2 InputSource can be passed to a SAX reader
 * @return The root of the abstract syntax tree
 */
public SyntaxTreeNode parse(InputSource input) {
    final XMLReader reader = JdkXmlUtils.getXMLReader(_overrideDefaultParser,
            _xsltc.isSecureProcessing());

    JdkXmlUtils.setXMLReaderPropertyIfSupport(reader, XMLConstants.ACCESS_EXTERNAL_DTD,
            _xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD), true);

    String lastProperty = "";
    try {
        XMLSecurityManager securityManager =
                (XMLSecurityManager) _xsltc.getProperty(XalanConstants.SECURITY_MANAGER);
        for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
            lastProperty = limit.apiProperty();
            reader.setProperty(lastProperty, securityManager.getLimitValueAsString(limit));
        }
        if (securityManager.printEntityCountInfo()) {
            lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO;
            reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
        }
    } catch (SAXException se) {
        XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se);
    }

    return (parse(reader, input));
}