me@web - 2006-12-21

Hello,

I have a big Problem with the Parser. I do the following:

Parser parser = new Parser("<html><div><b>text</b><img ... /></div></html>");
NodeList nodeList = parser.extractAllNodesThatMatch(this);
String output = nodeList.toHtml();

Let´s say, the accept method from NodeFilter just filters out img tags. Later I want to modify this and filter out and modify more nodes, but at the moment I have a problem with the output.

It looks like this:
<html><div><b>text</b><img ... /></div></html><div><b>text</b><img ... /></div><b>text</b></div></html>

and should look like this:
<html><div><b>text</b></div></html>

Possibly is the nodeList.toHtml() method the wrong one, because it outputs all nodes, but I just want the modified html. If I just output the first node, the filtered tags are still in. How can I solve my problem?

I also tried to do it with NodeVisitor but didn´t succeed either.
I would be very thankful if you could help me!

Merry christmas!
me@web