dear all,
we've got a showstopper issue related to the
nextNode
method taking an extremely long time
when:
- you're nextNode'ing on a largish
document
- the element you're searching for doesn't
exist.
nextNode can hang for 30-40 seconds on a
document
with, say, 30 elements, each element having 10
attributes,
and the element being searched for doesn't
exist.
i've tried with/without hotspot, and also run
through
the debugger but don't know whether the
behaviour
i'm seeing is normal.
below is a sample that demonstrates the
behaviour
i'm not sure about.
do we have a dodgy NodeFilter
implementation?
or does TreeWalkerImpl have a bug?
input xml doc.
<a>
<b/> <c/> <f> <g> <h> <i> <j/> </i> </h> </g> </f> </a> output from a println within our NodeFilter implementation
(attached).
b
c f g h i j i h g f a <= i'm ok down to here. this is the top of the tree again so should things stop here? h g f a g f a f a a thanks very much,
greg.
jdk1.2.2
windows 2000
Xerces-1_0_3 Java
|
package com.traveltech.shared; import org.apache.xerces.dom.*; import org.w3c.dom.*; import org.w3c.dom.traversal.*;
/** * Base filter used to traverse a DOM */ public class ElementFilter implements NodeFilter { private String name = null; public ElementFilter() { this(null); } public ElementFilter( String name ) { this.name = name; } public short acceptNode( Node n ) { System.out.println( n.getNodeName()); if(( name == null || n.getNodeName().equals( this.name ) ) && n.getNodeType() == Node.ELEMENT_NODE ) { return FILTER_ACCEPT; } return FILTER_SKIP; } public void setName( String name ) { this.name = name; } }