当前位置: 首页>>代码示例>>Java>>正文


Java AbstractTranslet.prepassDocument方法代码示例

本文整理汇总了Java中com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet.prepassDocument方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractTranslet.prepassDocument方法的具体用法?Java AbstractTranslet.prepassDocument怎么用?Java AbstractTranslet.prepassDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet的用法示例。


在下文中一共展示了AbstractTranslet.prepassDocument方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: document

import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet; //导入方法依赖的package包/类
/**
 * Create a DTMAxisIterator for the newdom. This is currently only
 * used to create an iterator for the cached stylesheet DOM.
 *
 * @param newdom the cached stylesheet DOM
 * @param translet the translet
 * @param the main dom (should be a MultiDOM)
 * @return a DTMAxisIterator from the document root
 */
private static DTMAxisIterator document(DOM newdom,
                                        AbstractTranslet translet,
                                        DOM dom)
    throws Exception
{
    DTMManager dtmManager = ((MultiDOM)dom).getDTMManager();
    // Need to migrate the cached DTM to the new DTMManager
    if (dtmManager != null && newdom instanceof DTM) {
        ((DTM)newdom).migrateTo(dtmManager);
    }

    translet.prepassDocument(newdom);

    // Wrap the DOM object in a DOM adapter and add to multiplexer
    final DOMAdapter domAdapter = translet.makeDOMAdapter(newdom);
    ((MultiDOM)dom).addDOMAdapter(domAdapter);

    // Create index for any key elements
    translet.buildKeys(domAdapter, null, null,
                       newdom.getDocument());

    // Return a singleton iterator containing the root node
    return new SingletonIterator(newdom.getDocument(), true);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:LoadDocument.java

示例2: retrieveDocument

import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet; //导入方法依赖的package包/类
/**
 * 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());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:62,代码来源:DocumentCache.java

示例3: retrieveDocument

import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet; //导入方法依赖的package包/类
/**
 * Returns a document either by finding it in the cache or
 * downloading it and putting it in the cache.
 */
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());
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:61,代码来源:DocumentCache.java


注:本文中的com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet.prepassDocument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。