Java Code Examples for com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM#getMapping()

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