if (cache == null) {
cache = new Cache();
documentTable.put(root, cache);
int n = 0;
for (NodeIterator iter =
new DescendantsOrSelfNodeIterator(root);;) {
Node tem = iter.next();
if (tem == null) {
break;
}
if (from != null && from.matches(tem, context)) {
n = 0;
} else if (count.matches(tem, context)) {
cache.append(tem, n++);
}
}
}
}
else if (node.getType() == Node.ELEMENT) {
Hashtable elementTable = (Hashtable)documentTable.get(root);
if (elementTable == null) {
elementTable = new Hashtable();
documentTable.put(root, elementTable);
}
Name name = node.getName();
cache = (Cache)elementTable.get(name);
if (cache == null) {
cache = new Cache();
elementTable.put(name, cache);
int n = 0;
for (NodeIterator iter = new DescendantsOrSelfNodeIterator(root);;) {
Node tem = iter.next();
if (tem == null)
break;
if (from != null && from.matches(tem, context))
n = 0;
else if (name.equals(tem.getName()) && tem.getType() == Node.ELEMENT)