com.sun.org.apache.xalan.internal.xsltc.Translet Java Examples

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.Translet. 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: TransformerImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected TransformerImpl(Translet translet, Properties outputProperties,
    int indentNumber, TransformerFactoryImpl tfactory)
{
    _translet = (AbstractTranslet) translet;
    _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);
    //_isIncremental = tfactory._incremental;
}
 
Example #2
Source File: TransformerImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
protected TransformerImpl(Translet translet, Properties outputProperties,
    int indentNumber, TransformerFactoryImpl tfactory)
{
    _translet = (AbstractTranslet) translet;
    _properties = createOutputProperties(outputProperties);
    _propertiesClone = (Properties) _properties.clone();
    _indentNumber = indentNumber;
    _tfactory = tfactory;
    _useServicesMechanism = _tfactory.useServicesMechnism();
    _accessExternalStylesheet = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET);
    _accessExternalDTD = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD);
    _securityManager = (XMLSecurityManager)_tfactory.getAttribute(XalanConstants.SECURITY_MANAGER);
    _readerManager = XMLReaderManager.getInstance(_useServicesMechanism);
    _readerManager.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
    _readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing);
    _readerManager.setProperty(XalanConstants.SECURITY_MANAGER, _securityManager);
    //_isIncremental = tfactory._incremental;
}
 
Example #3
Source File: TransformerImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected TransformerImpl(Translet translet, Properties outputProperties,
    int indentNumber, TransformerFactoryImpl tfactory)
{
    _translet = (AbstractTranslet) translet;
    _properties = createOutputProperties(outputProperties);
    _propertiesClone = (Properties) _properties.clone();
    _indentNumber = indentNumber;
    _tfactory = tfactory;
    _useServicesMechanism = _tfactory.useServicesMechnism();
    _accessExternalStylesheet = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET);
    _accessExternalDTD = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD);
    _securityManager = (XMLSecurityManager)_tfactory.getAttribute(XalanConstants.SECURITY_MANAGER);
    _readerManager = XMLReaderManager.getInstance(_useServicesMechanism);
    _readerManager.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
    _readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing);
    _readerManager.setProperty(XalanConstants.SECURITY_MANAGER, _securityManager);
    //_isIncremental = tfactory._incremental;
}
 
Example #4
Source File: TransformerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected TransformerImpl(Translet translet, Properties outputProperties,
    int indentNumber, TransformerFactoryImpl tfactory)
{
    _translet = (AbstractTranslet) translet;
    _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);
    //_isIncremental = tfactory._incremental;
}
 
Example #5
Source File: TransformerImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This class should only be used as a DOMCache for the translet if the
 * URIResolver has been set.
 *
 * The method implements XSLTC's DOMCache interface, which is used to
 * plug in an external document loader into a translet. This method acts
 * as an adapter between TrAX's URIResolver interface and XSLTC's
 * DOMCache interface. This approach is simple, but removes the
 * possibility of using external document caches with XSLTC.
 *
 * @param baseURI The base URI used by the document call.
 * @param href The href argument passed to the document function.
 * @param translet A reference to the translet requesting the document
 */
@Override
public DOM retrieveDocument(String baseURI, String href, Translet translet) {
    try {
        // Argument to document function was: document('');
        if (href.length() == 0) {
            href = baseURI;
        }

        /*
         *  Fix for bug 24188
         *  Incase the _uriResolver.resolve(href,base) is null
         *  try to still  retrieve the document before returning null
         *  and throwing the FileNotFoundException in
         *  com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument
         *
         */
        Source resolvedSource = _uriResolver.resolve(href, baseURI);
        if (resolvedSource == null)  {
            StreamSource streamSource = new StreamSource(
                 SystemIDResolver.getAbsoluteURI(href, baseURI));
            return getDOM(streamSource) ;
        }

        return getDOM(resolvedSource);
    }
    catch (TransformerException e) {
        if (_errorListener != null)
            postErrorToListener("File not found: " + e.getMessage());
        return(null);
    }
}
 
Example #6
Source File: TransformerImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * This class should only be used as a DOMCache for the translet if the
 * URIResolver has been set.
 *
 * The method implements XSLTC's DOMCache interface, which is used to
 * plug in an external document loader into a translet. This method acts
 * as an adapter between TrAX's URIResolver interface and XSLTC's
 * DOMCache interface. This approach is simple, but removes the
 * possibility of using external document caches with XSLTC.
 *
 * @param baseURI The base URI used by the document call.
 * @param href The href argument passed to the document function.
 * @param translet A reference to the translet requesting the document
 */
@Override
public DOM retrieveDocument(String baseURI, String href, Translet translet) {
    try {
        // Argument to document function was: document('');
        if (href.length() == 0) {
            href = baseURI;
        }

        /*
         *  Fix for bug 24188
         *  Incase the _uriResolver.resolve(href,base) is null
         *  try to still  retrieve the document before returning null
         *  and throwing the FileNotFoundException in
         *  com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument
         *
         */
        Source resolvedSource = _uriResolver.resolve(href, baseURI);
        if (resolvedSource == null)  {
            StreamSource streamSource = new StreamSource(
                 SystemIDResolver.getAbsoluteURI(href, baseURI));
            return getDOM(streamSource) ;
        }

        return getDOM(resolvedSource);
    }
    catch (TransformerException e) {
        if (_errorListener != null)
            postErrorToListener("File not found: " + e.getMessage());
        return(null);
    }
}
 
Example #7
Source File: NodeCounter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected NodeCounter(Translet translet,
          DOM document, DTMAxisIterator iterator, boolean hasFrom) {
    _translet = translet;
    _document = document;
    _iterator = iterator;
    _hasFrom = hasFrom;
}
 
Example #8
Source File: TransformerImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This class should only be used as a DOMCache for the translet if the
 * URIResolver has been set.
 *
 * The method implements XSLTC's DOMCache interface, which is used to
 * plug in an external document loader into a translet. This method acts
 * as an adapter between TrAX's URIResolver interface and XSLTC's
 * DOMCache interface. This approach is simple, but removes the
 * possibility of using external document caches with XSLTC.
 *
 * @param baseURI The base URI used by the document call.
 * @param href The href argument passed to the document function.
 * @param translet A reference to the translet requesting the document
 */
@Override
public DOM retrieveDocument(String baseURI, String href, Translet translet) {
    try {
        // Argument to document function was: document('');
        if (href.length() == 0) {
            href = baseURI;
        }

        /*
         *  Fix for bug 24188
         *  Incase the _uriResolver.resolve(href,base) is null
         *  try to still  retrieve the document before returning null
         *  and throwing the FileNotFoundException in
         *  com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument
         *
         */
        Source resolvedSource = _uriResolver.resolve(href, baseURI);
        if (resolvedSource == null)  {
            StreamSource streamSource = new StreamSource(
                 SystemIDResolver.getAbsoluteURI(href, baseURI));
            return getDOM(streamSource) ;
        }

        return getDOM(resolvedSource);
    }
    catch (TransformerException e) {
        if (_errorListener != null)
            postErrorToListener("File not found: " + e.getMessage());
        return(null);
    }
}
 
Example #9
Source File: NodeCounter.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
protected NodeCounter(Translet translet,
          DOM document, DTMAxisIterator iterator, boolean hasFrom) {
    _translet = translet;
    _document = document;
    _iterator = iterator;
    _hasFrom = hasFrom;
}
 
Example #10
Source File: NodeCounter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected NodeCounter(Translet translet,
          DOM document, DTMAxisIterator iterator, boolean hasFrom) {
    _translet = translet;
    _document = document;
    _iterator = iterator;
    _hasFrom = hasFrom;
}
 
Example #11
Source File: TransformerImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * This class should only be used as a DOMCache for the translet if the
 * URIResolver has been set.
 *
 * The method implements XSLTC's DOMCache interface, which is used to
 * plug in an external document loader into a translet. This method acts
 * as an adapter between TrAX's URIResolver interface and XSLTC's
 * DOMCache interface. This approach is simple, but removes the
 * possibility of using external document caches with XSLTC.
 *
 * @param baseURI The base URI used by the document call.
 * @param href The href argument passed to the document function.
 * @param translet A reference to the translet requesting the document
 */
@Override
public DOM retrieveDocument(String baseURI, String href, Translet translet) {
    try {
        // Argument to document function was: document('');
        if (href.length() == 0) {
            href = baseURI;
        }

        /*
         *  Fix for bug 24188
         *  Incase the _uriResolver.resolve(href,base) is null
         *  try to still  retrieve the document before returning null
         *  and throwing the FileNotFoundException in
         *  com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument
         *
         */
        Source resolvedSource = _uriResolver.resolve(href, baseURI);
        if (resolvedSource == null)  {
            StreamSource streamSource = new StreamSource(
                 SystemIDResolver.getAbsoluteURI(href, baseURI));
            return getDOM(streamSource) ;
        }

        return getDOM(resolvedSource);
    }
    catch (TransformerException e) {
        if (_errorListener != null)
            postErrorToListener("File not found: " + e.getMessage());
        return(null);
    }
}
 
Example #12
Source File: SingleNodeCounter.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public DefaultSingleNodeCounter(Translet translet,
                                DOM document, DTMAxisIterator iterator) {
    super(translet, document, iterator);
}
 
Example #13
Source File: MultipleNodeCounter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public DefaultMultipleNodeCounter(Translet translet,
                                  DOM document,
                                  DTMAxisIterator iterator) {
    super(translet, document, iterator);
}
 
Example #14
Source File: DocumentCache.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Returns a document either by finding it in the cache or
 * downloading it and putting it in the cache.
 */
@Override
public DOM retrieveDocument(String baseURI, String href, Translet trs) {
    CachedDocument doc;

String uri = href;
if (baseURI != null && !baseURI.equals("")) {
    try {
        uri = SystemIDResolver.getAbsoluteURI(uri, baseURI);
    } catch (TransformerException te) {
        // ignore
    }
}

    // Try to get the document from the cache first
    if ((doc = lookupDocument(uri)) == null) {
        doc = new CachedDocument(uri);
        if (doc == null) return null; // better error handling needed!!!
        doc.setLastModified(getLastModified(uri));
        insertDocument(uri, doc);
    }
    // If the document is in the cache we must check if it is still valid
    else {
        long now = System.currentTimeMillis();
        long chk = doc.getLastChecked();
        doc.setLastChecked(now);
        // Has the modification time for this file been checked lately?
        if (now > (chk + REFRESH_INTERVAL)) {
            doc.setLastChecked(now);
            long last = getLastModified(uri);
            // Reload document if it has been modified since last download
            if (last > doc.getLastModified()) {
                doc = new CachedDocument(uri);
                if (doc == null) return null;
                doc.setLastModified(getLastModified(uri));
                replaceDocument(uri, doc);
            }
        }

    }

    // Get the references to the actual DOM and DTD handler
    final DOM dom = doc.getDocument();

    // The dom reference may be null if the URL pointed to a
    // non-existing document
    if (dom == null) return null;

    doc.incAccessCount(); // For statistics

    final AbstractTranslet translet = (AbstractTranslet)trs;

    // Give the translet an early opportunity to extract any
    // information from the DOM object that it would like.
    translet.prepassDocument(dom);

    return(doc.getDocument());
}
 
Example #15
Source File: AnyNodeCounter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public AnyNodeCounter(Translet translet,
                      DOM document, DTMAxisIterator iterator) {
    super(translet, document, iterator);
}
 
Example #16
Source File: AnyNodeCounter.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public AnyNodeCounter(Translet translet,
                      DOM document,
                      DTMAxisIterator iterator,
                      boolean hasFrom) {
    super(translet, document, iterator, hasFrom);
}
 
Example #17
Source File: AnyNodeCounter.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public AnyNodeCounter(Translet translet,
                      DOM document, DTMAxisIterator iterator) {
    super(translet, document, iterator);
}
 
Example #18
Source File: MultipleNodeCounter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public MultipleNodeCounter(Translet translet,
                           DOM document,
                           DTMAxisIterator iterator,
                           boolean hasFrom) {
    super(translet, document, iterator, hasFrom);
}
 
Example #19
Source File: SingleNodeCounter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public DefaultSingleNodeCounter(Translet translet,
                                DOM document, DTMAxisIterator iterator) {
    super(translet, document, iterator);
}
 
Example #20
Source File: SingleNodeCounter.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public static NodeCounter getDefaultNodeCounter(Translet translet,
                                                DOM document,
                                                DTMAxisIterator iterator) {
    return new DefaultSingleNodeCounter(translet, document, iterator);
}
 
Example #21
Source File: DocumentCache.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns a document either by finding it in the cache or
 * downloading it and putting it in the cache.
 */
@Override
public DOM retrieveDocument(String baseURI, String href, Translet trs) {
    CachedDocument doc;

String uri = href;
if (baseURI != null && !baseURI.equals("")) {
    try {
        uri = SystemIDResolver.getAbsoluteURI(uri, baseURI);
    } catch (TransformerException te) {
        // ignore
    }
}

    // Try to get the document from the cache first
    if ((doc = lookupDocument(uri)) == null) {
        doc = new CachedDocument(uri);
        if (doc == null) return null; // better error handling needed!!!
        doc.setLastModified(getLastModified(uri));
        insertDocument(uri, doc);
    }
    // If the document is in the cache we must check if it is still valid
    else {
        long now = System.currentTimeMillis();
        long chk = doc.getLastChecked();
        doc.setLastChecked(now);
        // Has the modification time for this file been checked lately?
        if (now > (chk + REFRESH_INTERVAL)) {
            doc.setLastChecked(now);
            long last = getLastModified(uri);
            // Reload document if it has been modified since last download
            if (last > doc.getLastModified()) {
                doc = new CachedDocument(uri);
                if (doc == null) return null;
                doc.setLastModified(getLastModified(uri));
                replaceDocument(uri, doc);
            }
        }

    }

    // Get the references to the actual DOM and DTD handler
    final DOM dom = doc.getDocument();

    // The dom reference may be null if the URL pointed to a
    // non-existing document
    if (dom == null) return null;

    doc.incAccessCount(); // For statistics

    final AbstractTranslet translet = (AbstractTranslet)trs;

    // Give the translet an early opportunity to extract any
    // information from the DOM object that it would like.
    translet.prepassDocument(dom);

    return(doc.getDocument());
}
 
Example #22
Source File: SingleNodeCounter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public DefaultSingleNodeCounter(Translet translet,
                                DOM document, DTMAxisIterator iterator) {
    super(translet, document, iterator);
}
 
Example #23
Source File: SingleNodeCounter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static NodeCounter getDefaultNodeCounter(Translet translet,
                                                DOM document,
                                                DTMAxisIterator iterator) {
    return new DefaultSingleNodeCounter(translet, document, iterator);
}
 
Example #24
Source File: SingleNodeCounter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public SingleNodeCounter(Translet translet,
                         DOM document,
                         DTMAxisIterator iterator,
                         boolean hasFrom) {
    super(translet, document, iterator, hasFrom);
}
 
Example #25
Source File: SingleNodeCounter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public SingleNodeCounter(Translet translet,
                         DOM document,
                         DTMAxisIterator iterator) {
    super(translet, document, iterator);
}
 
Example #26
Source File: MultipleNodeCounter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public DefaultMultipleNodeCounter(Translet translet,
                                  DOM document,
                                  DTMAxisIterator iterator) {
    super(translet, document, iterator);
}
 
Example #27
Source File: MultipleNodeCounter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static NodeCounter getDefaultNodeCounter(Translet translet,
                                                DOM document,
                                                DTMAxisIterator iterator) {
    return new DefaultMultipleNodeCounter(translet, document, iterator);
}
 
Example #28
Source File: MultipleNodeCounter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public MultipleNodeCounter(Translet translet,
                           DOM document,
                           DTMAxisIterator iterator,
                           boolean hasFrom) {
    super(translet, document, iterator, hasFrom);
}
 
Example #29
Source File: MultipleNodeCounter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public MultipleNodeCounter(Translet translet,
                           DOM document, DTMAxisIterator iterator) {
    super(translet, document, iterator);
}
 
Example #30
Source File: SingleNodeCounter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public SingleNodeCounter(Translet translet,
                         DOM document,
                         DTMAxisIterator iterator) {
    super(translet, document, iterator);
}