*/
protected IntegerArray lookupNodes(int root, String keyValue) {
IntegerArray result = null;
// Get mapping from key values/IDs to DTM nodes for this document
Hashtable index = (Hashtable)_rootToIndexMap.get(new Integer(root));
if (!_isKeyIterator) {
// For id function, tokenize argument as whitespace separated
// list of values and look up nodes identified by each ID.
final StringTokenizer values =
new StringTokenizer(keyValue, " \n\t");
while (values.hasMoreElements()) {
final String token = (String) values.nextElement();
IntegerArray nodes = null;
// Does the ID map to any node in the document?
if (index != null) {
nodes = (IntegerArray) index.get(token);
}
// If input was from W3C DOM, use DOM's getElementById to do
// the look-up.
if (nodes == null && _enhancedDOM != null
&& _enhancedDOM.hasDOMSource()) {
nodes = getDOMNodeById(token);
}
// If we found any nodes, merge them into the cumulative
// result
if (nodes != null) {
if (result == null) {
result = (IntegerArray)nodes.clone();
} else {
result.merge(nodes);
}
}
}
} else if (index != null) {
// For key function, map key value to nodes
result = (IntegerArray) index.get(keyValue);
}
return result;
}