sorry, forgot to include version
details.
Xerces-J 1.0.3, Windows 2000,
JDK1.3rc1
seems to happen with jdk1.2.2 (no HotSpot) as
well.
this is a real showstopper for us. it can take 30-40
seconds for the nextNode method to finish.
is using a treewalker with a nodefilter the
correct
approach to locating
a specific node within a doc?
thanks,
greg.
----- Original Message -----
Sent: Thursday, March 16, 2000 4:01
PM
Subject: treewalker. can someone explain
this?
dear all,
we're having some wierd stuff happening with
treewalkers and the nextnode method.
i'm printing which nodes the nodefilter (see
attached) gets passed and it seems like something is going wrong.
can anyone see what we might be doing wrong? or
is this a bug?
the funny behaviour *only* seems to happen when
we try to find a node that doesn't exist in the xml document, e.g. search for
an element called "fred" in the document shown below.
input xml doc.
<a> <b/>
<c/> <f>
<g>
<h>
<i>
<j/> </i>
</h>
</g> </f> </a>
output from elementfilter, which does a println
as the first line in it's accept method.
b c f g h i j i h g f a
<= i'm ok down to here. what's the rest of the stuff
though? h g f a g f a f a a
the treewalker is created with the following
code.
org.apache.xerces.dom.DocumentImpl
impl =
(org.apache.xerces.dom.DocumentImpl)node.getOwnerDocument(); TreeWalker
tw = impl.createTreeWalker( node, (short)NodeFilter.SHOW_ELEMENT, new
ElementFilter( nodeName ));
thanks,
greg.
|