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

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM. 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: DocumentCache.java    From openjdk-8-source with GNU General Public License v2.0 7 votes vote down vote up
/**
 * 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;
    }
}
 
Example #2
Source File: DocumentCache.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example #3
Source File: DocumentCache.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example #4
Source File: DocumentCache.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example #5
Source File: DocumentCache.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example #6
Source File: DocumentCache.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example #7
Source File: DocumentCache.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example #8
Source File: DocumentCache.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example #9
Source File: DocumentCache.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example #10
Source File: DocumentCache.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example #11
Source File: DocumentCache.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example #12
Source File: DOMAdapter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #13
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 #14
Source File: DOMAdapter.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #15
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 #16
Source File: DOMAdapter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #17
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 #18
Source File: DOMAdapter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #19
Source File: DOMAdapter.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #20
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 #21
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 #22
Source File: DOMAdapter.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #23
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 #24
Source File: DOMAdapter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #25
Source File: DOMAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #26
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 #27
Source File: DOMAdapter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #28
Source File: DOMAdapter.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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;
}
 
Example #29
Source File: DOMAdapter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #30
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);
            }
        }
    }
}