Re: [Htmlparser-user] Getting all tags??
Brought to you by:
derrickoswald
|
From: Thomas Z. <li...@th...> - 2006-04-25 19:04:58
|
Derrick Oswald schrieb:
> Sorry about that. I fixed the ocumentation. Just supply a null...
> NodeList list = parser.parse (null);
> Note that the tags will be nested so the list is only as long as the
> count of enclosing tags, usually just one, i.e. <HTML>.
>
> If you want nodes in a simple sequential order without nesting, use
> the lexer...
> Parser parser = new Parser ("http://whatever");
> Lexer lexer = parser.getLexer ();
> Node node;
> while (null != (node = lexer.nextNode ())
> ... do something with the node
>
Dear Derrick,
thank you for your help ;-)
So, maybe I can ask another question ... I got this code:
Parser parser = new
Parser("/gb/testfiles/abraham/fabeln/antwort.htm");
Lexer lexer = parser.getLexer();
Node node;
String s;
while(null != lexer.nextNode()){
node = lexer.nextNode();
s = node.toPlainTextString();
System.out.println(s);
}
Works fine, but it prints me the content of the tags, not the names of
the tags? But I just need to know which tags are used in the document...
Thank you very much!
Greetings,
Tom
|