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


Java DOMEnhancedForDTM类代码示例

本文整理汇总了Java中com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM的典型用法代码示例。如果您正苦于以下问题:Java DOMEnhancedForDTM类的具体用法?Java DOMEnhancedForDTM怎么用?Java DOMEnhancedForDTM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DOMEnhancedForDTM类属于com.sun.org.apache.xalan.internal.xsltc包,在下文中一共展示了DOMEnhancedForDTM类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadDocument

import com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM; //导入依赖的package包/类
/**
 * Loads the document and updates build-time (latency) statistics
 */
public void loadDocument(String uri) {

    try {
        final long stamp = System.currentTimeMillis();
        _dom = (DOMEnhancedForDTM)_dtmManager.getDTM(
                         new SAXSource(_reader, new InputSource(uri)),
                         false, null, true, false);
        _dom.setDocumentURI(uri);

        // The build time can be used for statistics for a better
        // priority algorithm (currently round robin).
        final long thisTime = System.currentTimeMillis() - stamp;
        if (_buildTime > 0)
            _buildTime = (_buildTime + thisTime) >>> 1;
        else
            _buildTime = thisTime;
    }
    catch (Exception e) {
        _dom = null;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:DocumentCache.java

示例2: DOMAdapter

import com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM; //导入依赖的package包/类
public DOMAdapter(DOM dom,
                  String[] namesArray,
                  String[] urisArray,
                  int[] typesArray,
                  String[] namespaceArray) {
    if (dom instanceof DOMEnhancedForDTM){
        _enhancedDOM = (DOMEnhancedForDTM) dom;
    }

    _dom = dom;
    _namesArray = namesArray;
    _urisArray = urisArray;
    _typesArray = typesArray;
    _namespaceArray = namespaceArray;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:DOMAdapter.java

示例3: buildIDIndex

import com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM; //导入依赖的package包/类
/**
 * Leverages the Key Class to implement the XSLT id() function.
 * buildIdIndex creates the index (##id) that Key Class uses.
 * The index contains the element node index (int) and Id value (String).
 */
private final void buildIDIndex(DOM document) {
    setRootForKeys(document.getDocument());

    if (document instanceof DOMEnhancedForDTM) {
        DOMEnhancedForDTM enhancedDOM = (DOMEnhancedForDTM)document;

        // If the input source is DOMSource, the KeyIndex table is not
        // built at this time. It will be built later by the lookupId()
        // and containsId() methods of the KeyIndex class.
        if (enhancedDOM.hasDOMSource()) {
            buildKeyIndex(ID_INDEX_NAME, document);
            return;
        }
        else {
            final Map<String, Integer> elementsByID = enhancedDOM.getElementsWithIDs();

            if (elementsByID == null) {
                return;
            }

            // Given a Map of DTM nodes indexed by ID attribute values,
            // loop through the table copying information to a KeyIndex
            // for the mapping from ID attribute value to DTM node
            boolean hasIDValues = false;
            for (Map.Entry<String, Integer> entry : elementsByID.entrySet()) {
                final int element = document.getNodeHandle(entry.getValue());
                buildKeyIndex(ID_INDEX_NAME, element, entry.getKey());
                hasIDValues = true;
            }

            if (hasIDValues) {
                setKeyIndexDom(ID_INDEX_NAME, document);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:42,代码来源:AbstractTranslet.java

示例4: getShouldStripSpace

import com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM; //导入依赖的package包/类
/**
 * Test whether whitespace-only text nodes are visible in the logical
 * view of <code>DTM</code>. Normally, this function
 * will be called by the implementation of <code>DTM</code>;
 * it is not normally called directly from
 * user code.
 *
 * @param node int handle of the node.
 * @param dtm the DTM that owns this node
 * @return one of <code>NOTSTRIP</code>, <code>STRIP</code> or
 * <code>INHERIT</code>.
 */
public short getShouldStripSpace(int node, DTM dtm) {
    if (m_filter != null && dtm instanceof DOM) {
        DOM dom = (DOM)dtm;
        int type = 0;

        if (dtm instanceof DOMEnhancedForDTM) {
            DOMEnhancedForDTM mappableDOM = (DOMEnhancedForDTM)dtm;

            short[] mapping;
            if (dtm == m_currentDTM) {
                mapping = m_currentMapping;
            }
            else {
                mapping = (short[])m_mappings.get(dtm);
                if (mapping == null) {
                    mapping = mappableDOM.getMapping(
                                 m_translet.getNamesArray(),
                                 m_translet.getUrisArray(),
                                 m_translet.getTypesArray());
                    m_mappings.put(dtm, mapping);
                    m_currentDTM = dtm;
                    m_currentMapping = mapping;
                }
            }

            int expType = mappableDOM.getExpandedTypeID(node);

            // %OPT% The mapping array does not have information about all the
            // exptypes. However it does contain enough information about all names
            // in the translet's namesArray. If the expType does not fall into the
            // range of the mapping array, it means that the expType is not for one
            // of the recognized names. In this case we can just set the type to -1.
            if (expType >= 0 && expType < mapping.length)
              type = mapping[expType];
            else
              type = -1;

        }
        else {
            return INHERIT;
        }

        if (m_filter.stripSpace(dom, node, type)) {
            return STRIP;
        } else {
            return NOTSTRIP;
        }
    } else {
        return NOTSTRIP;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:64,代码来源:DOMWSFilter.java

示例5: buildIDIndex

import com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM; //导入依赖的package包/类
/**
 * Leverages the Key Class to implement the XSLT id() function.
 * buildIdIndex creates the index (##id) that Key Class uses.
 * The index contains the element node index (int) and Id value (String).
 */
private final void buildIDIndex(DOM document) {
    setRootForKeys(document.getDocument());

    if (document instanceof DOMEnhancedForDTM) {
        DOMEnhancedForDTM enhancedDOM = (DOMEnhancedForDTM)document;

        // If the input source is DOMSource, the KeyIndex table is not
        // built at this time. It will be built later by the lookupId()
        // and containsId() methods of the KeyIndex class.
        if (enhancedDOM.hasDOMSource()) {
            buildKeyIndex(ID_INDEX_NAME, document);
            return;
        }
        else {
            final Hashtable elementsByID = enhancedDOM.getElementsWithIDs();

            if (elementsByID == null) {
                return;
            }

            // Given a Hashtable of DTM nodes indexed by ID attribute values,
            // loop through the table copying information to a KeyIndex
            // for the mapping from ID attribute value to DTM node
            final Enumeration idValues = elementsByID.keys();
            boolean hasIDValues = false;

            while (idValues.hasMoreElements()) {
                final Object idValue = idValues.nextElement();
                final int element =
                        document.getNodeHandle(
                                    ((Integer)elementsByID.get(idValue))
                                            .intValue());

                buildKeyIndex(ID_INDEX_NAME, element, idValue);
                hasIDValues = true;
            }

            if (hasIDValues) {
                setKeyIndexDom(ID_INDEX_NAME, document);
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:49,代码来源:AbstractTranslet.java

示例6: getShouldStripSpace

import com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM; //导入依赖的package包/类
/**
 * Test whether whitespace-only text nodes are visible in the logical
 * view of <code>DTM</code>. Normally, this function
 * will be called by the implementation of <code>DTM</code>;
 * it is not normally called directly from
 * user code.
 *
 * @param node int handle of the node.
 * @param dtm the DTM that owns this node
 * @return one of <code>NOTSTRIP</code>, <code>STRIP</code> or
 * <code>INHERIT</code>.
 */
public short getShouldStripSpace(int node, DTM dtm) {
    if (m_filter != null && dtm instanceof DOM) {
        DOM dom = (DOM)dtm;
        int type = 0;

        if (dtm instanceof DOMEnhancedForDTM) {
            DOMEnhancedForDTM mappableDOM = (DOMEnhancedForDTM)dtm;

            short[] mapping;
            if (dtm == m_currentDTM) {
                mapping = m_currentMapping;
            }
            else {
                mapping = m_mappings.get(dtm);
                if (mapping == null) {
                    mapping = mappableDOM.getMapping(
                                 m_translet.getNamesArray(),
                                 m_translet.getUrisArray(),
                                 m_translet.getTypesArray());
                    m_mappings.put(dtm, mapping);
                    m_currentDTM = dtm;
                    m_currentMapping = mapping;
                }
            }

            int expType = mappableDOM.getExpandedTypeID(node);

            // %OPT% The mapping array does not have information about all the
            // exptypes. However it does contain enough information about all names
            // in the translet's namesArray. If the expType does not fall into the
            // range of the mapping array, it means that the expType is not for one
            // of the recognized names. In this case we can just set the type to -1.
            if (expType >= 0 && expType < mapping.length)
              type = mapping[expType];
            else
              type = -1;

        }
        else {
            return INHERIT;
        }

        if (m_filter.stripSpace(dom, node, type)) {
            return STRIP;
        } else {
            return NOTSTRIP;
        }
    } else {
        return NOTSTRIP;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:64,代码来源:DOMWSFilter.java


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