Re: [Htmlparser-user] How to use it.
Brought to you by:
derrickoswald
From: Navid H.L. <na...@ya...> - 2002-11-27 01:49:57
|
Thank you Somik, It worked as I wanted. Also using the parser classes, I could extract each part of page data separatly. Well, now I reached to the real difficult part. I am trying to extract meaningful data from some sites, like a site products names, discription and keywords, which is not always in meta tags. Do have any suggestion? Navid --- Somik Raha <so...@ya...> wrote: > Hi Navid, > I ran the program, and it does exactly what I > expected. > But I see your doubt now. You want to suppress the > exception messages. These are happening because of > DefaultHMLParserFeedback(). Pls write your own > NullHTMLParserFeedback(), that does not print > anything > when it encounters an error, and use that to > initialize the parser. Read the javadoc of > HTMLParser.java carefully. > > I have written the modified program for you : > public void testNullUrl(){ > try { > parser = new > HTMLParser("http://www.yahooeeeeee.com",new > HTMLParserFeedback() { > /** > * @see > org.htmlparser.util.HTMLParserFeedback#info(String) > */ > public void info(String message) { > } > > /** > * @see > org.htmlparser.util.HTMLParserFeedback#warning(String) > */ > public void warning(String message) { > } > > /** > * @see > org.htmlparser.util.HTMLParserFeedback#error(String, > HTMLParserException) > */ > public void error(String message, > HTMLParserException e) { > } > }); > //assertTrue("Should have thrown an > exception!",false); > parser.registerScanners(); > parser.addScanner(new HTMLLinkScanner("-l")); > > } > catch (HTMLParserException e) { > System.out.println("Can not connect the URL!"); > } > } > > Try this- it should give you what you want now. > > Regards > Somik > > (The earlier mail went before I could complete it..) > > __________________________________________________ > Do you Yahoo!? > Yahoo! Mail Plus Powerful. Affordable. Sign up > now. > http://mailplus.yahoo.com > > > ------------------------------------------------------- > This SF.net email is sponsored by: Get the new Palm > Tungsten T > handheld. Power & Color in a compact size! > http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en > _______________________________________________ > Htmlparser-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlparser-user __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com |