com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC Java Examples

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC. 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: TransformerFactoryImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
@Override
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        if (_uriResolver != null) {
            final Source source = _uriResolver.resolve(href, context);
            if (source != null) {
                return Util.getInputSource(xsltc, source);
            }
        }
    }
    catch (TransformerException e) {
        // should catch it when the resolver explicitly throws the exception
        final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
        xsltc.getParser().reportError(Constants.FATAL, msg);
    }

    return null;
}
 
Example #2
Source File: TransformerFactoryImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
@Override
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        if (_uriResolver != null) {
            final Source source = _uriResolver.resolve(href, context);
            if (source != null) {
                return Util.getInputSource(xsltc, source);
            }
        }
    }
    catch (TransformerException e) {
        // should catch it when the resolver explicitly throws the exception
        final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
        xsltc.getParser().reportError(Constants.FATAL, msg);
    }

    return null;
}
 
Example #3
Source File: TransformerFactoryImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
@Override
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        if (_uriResolver != null) {
            final Source source = _uriResolver.resolve(href, context);
            if (source != null) {
                return Util.getInputSource(xsltc, source);
            }
        }
    }
    catch (TransformerException e) {
        // should catch it when the resolver explicitly throws the exception
        final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
        xsltc.getParser().reportError(Constants.FATAL, msg);
    }

    return null;
}
 
Example #4
Source File: TransformerFactoryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
@Override
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        if (_uriResolver != null) {
            final Source source = _uriResolver.resolve(href, context);
            if (source != null) {
                return Util.getInputSource(xsltc, source);
            }
        }
    }
    catch (TransformerException e) {
        // should catch it when the resolver explicitly throws the exception
        final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
        xsltc.getParser().reportError(Constants.FATAL, msg);
    }

    return null;
}
 
Example #5
Source File: TransformerFactoryImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
@Override
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        if (_uriResolver != null) {
            final Source source = _uriResolver.resolve(href, context);
            if (source != null) {
                return Util.getInputSource(xsltc, source);
            }
        }
    }
    catch (TransformerException e) {
        // should catch it when the resolver explicitly throws the exception
        final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
        xsltc.getParser().reportError(Constants.FATAL, msg);
    }

    return null;
}
 
Example #6
Source File: TransformerFactoryImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
@Override
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        if (_uriResolver != null) {
            final Source source = _uriResolver.resolve(href, context);
            if (source != null) {
                return Util.getInputSource(xsltc, source);
            }
        }
    }
    catch (TransformerException e) {
        // should catch it when the resolver explicitly throws the exception
        final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
        xsltc.getParser().reportError(Constants.FATAL, msg);
    }

    return null;
}
 
Example #7
Source File: TransformerFactoryImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
@Override
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        if (_uriResolver != null) {
            final Source source = _uriResolver.resolve(href, context);
            if (source != null) {
                return Util.getInputSource(xsltc, source);
            }
        }
    }
    catch (TransformerException e) {
        // should catch it when the resolver explicitly throws the exception
        final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
        xsltc.getParser().reportError(Constants.FATAL, msg);
    }

    return null;
}
 
Example #8
Source File: TransformerFactoryImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
@Override
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        if (_uriResolver != null) {
            final Source source = _uriResolver.resolve(href, context);
            if (source != null) {
                return Util.getInputSource(xsltc, source);
            }
        }
    }
    catch (TransformerException e) {
        // should catch it when the resolver explicitly throws the exception
        final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
        xsltc.getParser().reportError(Constants.FATAL, msg);
    }

    return null;
}
 
Example #9
Source File: TransformerFactoryImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
@Override
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        if (_uriResolver != null) {
            final Source source = _uriResolver.resolve(href, context);
            if (source != null) {
                return Util.getInputSource(xsltc, source);
            }
        }
    }
    catch (TransformerException e) {
        // should catch it when the resolver explicitly throws the exception
        final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
        xsltc.getParser().reportError(Constants.FATAL, msg);
    }

    return null;
}
 
Example #10
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 #11
Source File: TemplatesHandlerImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        // A _uriResolver must be set if this method is called
        final Source source = _uriResolver.resolve(href, context);
        if (source != null) {
            return Util.getInputSource(xsltc, source);
        }
    }
    catch (TransformerException e) {
        // Falls through
    }
    return null;
}
 
Example #12
Source File: TemplatesHandlerImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Re-initialize parser and forward SAX2 event.
 */
public void startDocument() {
    XSLTC xsltc = _parser.getXSLTC();
    xsltc.init();   // calls _parser.init()
    xsltc.setOutputType(XSLTC.BYTEARRAY_OUTPUT);
    _parser.startDocument();
}
 
Example #13
Source File: TemplatesHandlerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Re-initialize parser and forward SAX2 event.
 */
public void startDocument() {
    XSLTC xsltc = _parser.getXSLTC();
    xsltc.init();   // calls _parser.init()
    xsltc.setOutputType(XSLTC.BYTEARRAY_OUTPUT);
    _parser.startDocument();
}
 
Example #14
Source File: TemplatesHandlerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Default constructor
 */
protected TemplatesHandlerImpl(int indentNumber,
    TransformerFactoryImpl tfactory)
{
    _indentNumber = indentNumber;
    _tfactory = tfactory;

    // Instantiate XSLTC and get reference to parser object
    XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism(), tfactory.getJdkXmlFeatures());
    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 #15
Source File: TemplatesHandlerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        // A _uriResolver must be set if this method is called
        final Source source = _uriResolver.resolve(href, context);
        if (source != null) {
            return Util.getInputSource(xsltc, source);
        }
    }
    catch (TransformerException e) {
        // Falls through
    }
    return null;
}
 
Example #16
Source File: TemplatesHandlerImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Default constructor
 */
protected TemplatesHandlerImpl(int indentNumber,
    TransformerFactoryImpl tfactory)
{
    _indentNumber = indentNumber;
    _tfactory = tfactory;

    // Instantiate XSLTC and get reference to parser object
    XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism(), tfactory.getFeatureManager());
    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);

    _parser = xsltc.getParser();
}
 
Example #17
Source File: TemplatesHandlerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        // A _uriResolver must be set if this method is called
        final Source source = _uriResolver.resolve(href, context);
        if (source != null) {
            return Util.getInputSource(xsltc, source);
        }
    }
    catch (TransformerException e) {
        // Falls through
    }
    return null;
}
 
Example #18
Source File: TemplatesHandlerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Re-initialize parser and forward SAX2 event.
 */
public void startDocument() {
    XSLTC xsltc = _parser.getXSLTC();
    xsltc.init();   // calls _parser.init()
    xsltc.setOutputType(XSLTC.BYTEARRAY_OUTPUT);
    _parser.startDocument();
}
 
Example #19
Source File: TemplatesHandlerImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Default constructor
 */
protected TemplatesHandlerImpl(int indentNumber,
    TransformerFactoryImpl tfactory)
{
    _indentNumber = indentNumber;
    _tfactory = tfactory;

    // Instantiate XSLTC and get reference to parser object
    XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism(), tfactory.getFeatureManager());
    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);

    _parser = xsltc.getParser();
}
 
Example #20
Source File: TemplatesHandlerImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        // A _uriResolver must be set if this method is called
        final Source source = _uriResolver.resolve(href, context);
        if (source != null) {
            return Util.getInputSource(xsltc, source);
        }
    }
    catch (TransformerException e) {
        // Falls through
    }
    return null;
}
 
Example #21
Source File: TemplatesHandlerImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Re-initialize parser and forward SAX2 event.
 */
public void startDocument() {
    XSLTC xsltc = _parser.getXSLTC();
    xsltc.init();   // calls _parser.init()
    xsltc.setOutputType(XSLTC.BYTEARRAY_OUTPUT);
    _parser.startDocument();
}
 
Example #22
Source File: TemplatesHandlerImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Default constructor
 */
protected TemplatesHandlerImpl(int indentNumber,
    TransformerFactoryImpl tfactory)
{
    _indentNumber = indentNumber;
    _tfactory = tfactory;

    // Instantiate XSLTC and get reference to parser object
    XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism(), tfactory.getFeatureManager());
    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);

    _parser = xsltc.getParser();
}
 
Example #23
Source File: TemplatesHandlerImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        // A _uriResolver must be set if this method is called
        final Source source = _uriResolver.resolve(href, context);
        if (source != null) {
            return Util.getInputSource(xsltc, source);
        }
    }
    catch (TransformerException e) {
        // Falls through
    }
    return null;
}
 
Example #24
Source File: TemplatesHandlerImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Re-initialize parser and forward SAX2 event.
 */
public void startDocument() {
    XSLTC xsltc = _parser.getXSLTC();
    xsltc.init();   // calls _parser.init()
    xsltc.setOutputType(XSLTC.BYTEARRAY_OUTPUT);
    _parser.startDocument();
}
 
Example #25
Source File: TemplatesHandlerImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Default constructor
 */
protected TemplatesHandlerImpl(int indentNumber,
    TransformerFactoryImpl tfactory)
{
    _indentNumber = indentNumber;
    _tfactory = tfactory;

    // Instantiate XSLTC and get reference to parser object
    XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism(), tfactory.getFeatureManager());
    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);

    _parser = xsltc.getParser();
}
 
Example #26
Source File: TemplatesHandlerImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        // A _uriResolver must be set if this method is called
        final Source source = _uriResolver.resolve(href, context);
        if (source != null) {
            return Util.getInputSource(xsltc, source);
        }
    }
    catch (TransformerException e) {
        // Falls through
    }
    return null;
}
 
Example #27
Source File: TemplatesHandlerImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Re-initialize parser and forward SAX2 event.
 */
public void startDocument() {
    XSLTC xsltc = _parser.getXSLTC();
    xsltc.init();   // calls _parser.init()
    xsltc.setOutputType(XSLTC.BYTEARRAY_OUTPUT);
    _parser.startDocument();
}
 
Example #28
Source File: TemplatesHandlerImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        // A _uriResolver must be set if this method is called
        final Source source = _uriResolver.resolve(href, context);
        if (source != null) {
            return Util.getInputSource(xsltc, source);
        }
    }
    catch (TransformerException e) {
        // Falls through
    }
    return null;
}
 
Example #29
Source File: TemplatesHandlerImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Re-initialize parser and forward SAX2 event.
 */
public void startDocument() {
    XSLTC xsltc = _parser.getXSLTC();
    xsltc.init();   // calls _parser.init()
    xsltc.setOutputType(XSLTC.BYTEARRAY_OUTPUT);
    _parser.startDocument();
}
 
Example #30
Source File: TemplatesHandlerImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Default constructor
 */
protected TemplatesHandlerImpl(int indentNumber,
    TransformerFactoryImpl tfactory)
{
    _indentNumber = indentNumber;
    _tfactory = tfactory;

    // Instantiate XSLTC and get reference to parser object
    XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism(), tfactory.getFeatureManager());
    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);

    _parser = xsltc.getParser();
}