Re: [Htmlparser-user] Getting all tags??
Brought to you by:
derrickoswald
|
From: Derrick O. <Der...@Ro...> - 2006-04-29 10:57:23
|
It's not clear why you aren't getting any output.
The same loop is in the Lexer mainline:
manager = Page.getConnectionManager ();
lexer = new Lexer (manager.openConnection (args[0]));
while (null != (node = lexer.nextNode (false)))
System.out.println (node.toString ());
The guard on the if statement should be satisfied for anything that
looks like a tag, i.e. <XXX>.
Thomas Zastrow wrote:
> Derrick Oswald schrieb:
>
>>
>> You will need to cast it to a tag if possible and use getTagName ():
>> if (node instanceof Tag)
>> System.out.println (((Tag)node).getTagName ());
>
>
> Step by step, I'll get it ... ;-)
>
> Now, this code produces no output, Am I still doing something wrong:
>
> 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();
> if(node instanceof Tag){
> System.out.println(((Tag)node).getTagName());
> } // if }
>
> Greetings and thank you again, I hope that sometimes I'll manage it on
> my own ...
>
> Best regards,
>
> Tom
>
>
>
> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Htmlparser-user mailing list
> Htm...@li...
> https://lists.sourceforge.net/lists/listinfo/htmlparser-user
>
|