Re: [Htmlparser-user] Tags look up
Brought to you by:
derrickoswald
From: Gaurav P. <gau...@gm...> - 2007-04-20 04:17:48
|
Hi, Try using the below stated code.This is basically ment for moving through the web-page node by node . So if u want to compare the nodes then try using this for both the urls. import org.htmlparser.Parser; import org.htmlparser.Tag; import org.htmlparser.Text; import org.htmlparser.util.ParserException; import org.htmlparser.visitors.NodeVisitor; public class MyVisitor extends NodeVisitor { public MyVisitor () { } public void visitTag (Tag tag) { System.out.println ("\n" + tag.getTagName () + tag.getStartPosition ()); } public void visitStringNode (Text string) { System.out.println (string); } public static void main (String[] args) throws ParserException { Parser parser = new Parser ("http://cbc.ca"); Visitor visitor = new MyVisitor (); parser.visitAllNodesWith (visitor); } On 20 Apr 2007 02:30:14 -0000, Dipesh Sharma <dip...@re...> wrote: > > Hi I'm trying to compare the html tag nodes of 2 different web pages by > taking one node at a time. Hence, I need to compare the 1st node of the 2 > web pages, then go to 2nd nodes and compare and so on. Could you plz help me > how i can achieve this. I''v tried to use Node iterator but haven't been > successfull. Attached is my code. > > > > > > > > [image: banner2]<http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.rediff.com/signature-home.htm/1050715198@Middle5/1165462_1159560/1164629/1?PARTNER=3&OAS_QUERY=null+target=new+> > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Htmlparser-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlparser-user > > > |