Results 1 to 1 of 1
Thread: problems with html parser
- 03-13-2010, 01:37 PM #1
Member
- Join Date
- Mar 2010
- Posts
- 10
- Rep Power
- 0
problems with html parser
i am trying to get all the links from web shearch. but i have an errors when i wrote an:
package org.htmlparser.Parser;
The declared package "org.htmlparser.Parser" does not match the expected package "hw"
and :
Parser parser = new Parser ("http://yadda");
The constructor Parser(String) is undefined
the full code,thanks for helping me:
Java Code:package hw; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; package org.htmlparser.Parser; import javax.swing.text.html.parser.Parser; public class spy { public static void main(String[] args) { String target = null; try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); target= in.readLine(); } catch(IOException e) { System.out.println("IOException has been caught"); } shearch(target); } private static void shearch(String target) { target = target.trim( ); QueryString query = new QueryString("search", target); try {//Open the URL for reading URL u = new URL("http://search.dmoz.org/cgi-bin/search?" + query); // buffer the input to increase performance InputStream in = new BufferedInputStream(u.openStream()); // chain the InputStream to a Reader InputStreamReader theHTML = new InputStreamReader(in); int c; Parser parser = new Parser ("http://yadda"); while ((c = theHTML.read()) != -1) { System.out.print((char)c); } } catch (MalformedURLException e) { System.err.println(e); } catch (IOException e) { System.err.println(e); }}}
Similar Threads
-
Problem with HTML parser
By kpraveenreddy in forum New To JavaReplies: 0Last Post: 03-02-2010, 02:12 PM -
help on java mozilla html parser.....
By nijil in forum New To JavaReplies: 7Last Post: 03-01-2010, 06:49 PM -
Jericho HTML Parser 2.6
By Java Tip in forum Java SoftwareReplies: 0Last Post: 06-26-2008, 06:22 PM -
Developing HTML Parser in JAVA
By shinojkk in forum Advanced JavaReplies: 1Last Post: 01-18-2008, 08:07 PM -
Jericho HTML Parser 2.4
By levent in forum Java SoftwareReplies: 0Last Post: 05-21-2007, 10:05 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks