if (ancestorId == NodeId.DOCUMENT_NODE) {
fromKey = computeKey(type, qname, doc.getDocId());
toKey = computeKey(type, qname, doc.getDocId() + 1);
} else {
fromKey = computeKey(type, qname, doc.getDocId(), ancestorId);
toKey = computeKey(type, qname, doc.getDocId(), ancestorId.nextSibling());
}
final IndexQuery query = new IndexQuery(IndexQuery.RANGE, new Value(fromKey), new Value(toKey));
try {
index.btree.query(query, callback);
} catch (final Exception e) {