Java Code Examples for com.sun.org.apache.xalan.internal.xsltc.DOM#getNodeHandle()

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.DOM#getNodeHandle() . 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: AbstractTranslet.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
            }
        }
    }
}
 
Example 2
Source File: AbstractTranslet.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
            }
        }
    }
}
 
Example 3
Source File: AbstractTranslet.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * 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);
            }
        }
    }
}
 
Example 4
Source File: AbstractTranslet.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
            }
        }
    }
}
 
Example 5
Source File: AbstractTranslet.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
            }
        }
    }
}
 
Example 6
Source File: AbstractTranslet.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
            }
        }
    }
}
 
Example 7
Source File: AbstractTranslet.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
            }
        }
    }
}
 
Example 8
Source File: AbstractTranslet.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
            }
        }
    }
}
 
Example 9
Source File: AbstractTranslet.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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);
            }
        }
    }
}
 
Example 10
Source File: AbstractTranslet.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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);
            }
        }
    }
}
 
Example 11
Source File: AbstractTranslet.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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);
            }
        }
    }
}