Re: [Htmlparser-developer] Automatic debug output
Brought to you by:
derrickoswald
From: Somik R. <so...@ya...> - 2002-12-11 19:46:03
|
Sorry, I just saw your other mail again with the output. I see the problem - You must be calling the parse method in HTMLParser.java. That is only a demo. As mentioned in the docs, you should be doing something like : (for HTMLEnumeration e = parser.elements();e.hasMoreNodes();) { HTMLNode node = e.nextHTMLNode(); // create summary here } The call to parse has the printing stuff which prints all the details of the nodes (calling node.print()). If this does not help, can you post your complete parsing program ? Regards, Somik --- Sam Joseph <ga...@yh...> wrote: > > Hi Somik > > > Somik wrote: > > >>Most importantly I seem to get a lot of debug > output > >>text that I would > >>prefer to avoid, see the examples below. Perhaps > I'm > >>mistaken but this > >>seems to be output by default. Is there some way > for > >>me to avoid getting > >>this debug output? > >> > >> > > > >Of course - HTMLParser now takes in a logging > object - > >HTMLParserFeedback. All you have to do is to > implement > >this interface and pass your object in to the > parser. > >If you don't, a DefaultHTMLParserFeedback object is > >created - and its function is to send log data to > >System.out. > > > Well I wrote the following: > > private class BlankHTMLParserFeedback > implements HTMLParserFeedback > { > public void info(String message) > { > //System.out.println("INFO: " + message); > } > > public void warning(String message) > { > //System.out.println("WARNING: " + message); > } > > public void error(String message, > HTMLParserException e) > { > //System.out.println("ERROR: " + message); > e.printStackTrace(); > } > } > > > > /** > * parse the page > */ > public final void parse() > throws Exception > { > if (o_parser==null) > o_parser = new HTMLParser(o_url, new > BlankHTMLParserFeedback()); > > o_parser.addScanner(new HTMLMetaTagScanner("-t")); > o_parser.addScanner(new HTMLLinkScanner("-l")); > o_parser.addScanner(new HTMLTitleScanner("-a")); > parseURLForData(); > o_summary = createSummary(); > } > > However I still seem to be getting the same debug > output. Can you see > what I am doing wrong? > > Have you considered using log4j? With log4j you have > a log4j properties > file and you can specify the debug level on a class > by class basis > within the properties file, and debug output can be > formatted to give > you useful info such as the line number of the code > where the debug > statement is. > > Thanks in advance. > > CHEERS> SAM > > p.s. is there some operation for picking up HTML > comments using the > HTMLParser (<!-- a comment -->) or are they > automatically ignored? > > > > > ------------------------------------------------------- > This sf.net email is sponsored by: > With Great Power, Comes Great Responsibility > Learn to use your power at OSDN's High Performance > Computing Channel > http://hpc.devchannel.org/ > _______________________________________________ > Htmlparser-developer mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlparser-developer __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com |