Results 1 to 9 of 9
  1. #1
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    448
    Rep Power
    6

    Default HTML FILE parsing.

    i want to parse my html file for finding out html links img links and so on.

    i read that java has class library for html parsing,isn't it?

    Any one know about html parsing for find out all links in that page,share with me.
    Mak
    (Living @ Virtual World)

  2. #2
    francojava1 is offline Member
    Join Date
    Sep 2010
    Posts
    26
    Rep Power
    0

    Default HTML File Parsing

    Okay, my friend, I could create a HTML parsing called XML Parser . Now I need any confirmation from you to can compile this HTML to you . I will send this HTML as attachments right, Thanks


    Furthermore, if you want to see my posted java program called HTML web page parsing scraping is was posted in advanced forum.

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,447
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by francojava1 View Post
    Okay, my friend, I could create a HTML parsing called XML Parser . Now I need any confirmation from you to can compile this HTML to you . I will send this HTML as attachments right, Thanks


    Furthermore, if you want to see my posted java program called HTML web page parsing scraping is was posted in advanced forum.
    Not all html is valid xml; better stick to the html parser (also included with your JRE) and start reading the API documentation for the HTMLEditorKit. It can supply an HTMLEditorKit.Parser for you and you can supply a callback object for it.

    kind regards,

    Jos

  4. #4
    francojava1 is offline Member
    Join Date
    Sep 2010
    Posts
    26
    Rep Power
    0

    Default HTML File parsing

    That's right, my partner Josha, my question is do you want to compile a HTML Parse Demo with HTMLEditorKit.Parser tell me please
    I will do it for you because I found a lots of codes as HTMLEditorkit.Parser.

    Tell me, if you want that I compile this project for you exactly.


    Thanks

  5. #5
    francojava1 is offline Member
    Join Date
    Sep 2010
    Posts
    26
    Rep Power
    0

    Default HTML File parsing

    Josha tells me if you want to compile HTMLEditorKit.Parser beccause I found a lots of codes that are applicable to his program. I will compile this for you.

    Thanks once more francojava1.

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,447
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by francojava1 View Post
    Josha tells me if you want to compile HTMLEditorKit.Parser beccause I found a lots of codes that are applicable to his program. I will compile this for you.

    Thanks once more francojava1.
    Erm, I don't know if I understood your remark but I don't have any html to compile but there's a lot of it out there ...

    kind regards,

    Jos

  7. #7
    francojava1 is offline Member
    Join Date
    Sep 2010
    Posts
    26
    Rep Power
    0

    Default

    Francojava1 is needing urgent reply from you about HTMLEditorkit.Parser codes because Iam going to compile these codes for you . Tell me please .Thanks

  8. #8
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,447
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by francojava1 View Post
    Francojava1 is needing urgent reply from you about HTMLEditorkit.Parser codes because Iam going to compile these codes for you . Tell me please .Thanks
    Erm the code for the HTMLEditorKit.Parser class already has been designed, written, compiled and distributed; it is part of your Java SE distribution.

    kind regards,

    Jos

  9. #9
    francojava1 is offline Member
    Join Date
    Sep 2010
    Posts
    26
    Rep Power
    0

    Default HTML File parsing

    Josah, francojava1, could compile this project very good with the following codes.

    package javax.swing.text.html;

    import java.io.*;
    import java.net.*;
    import javax.swing.text.html.parser.*;
    import javax.swing.text.html.*;

    /*
    *
    * @author User: Alfonso Franco, who developed this demo
    * program how to use the HTMLEditorkit.Parser and its implementing class ParserDelegator in the Swing system. Also, as a
    * file is calling back to the HTMLParseLister being object.
    */

    public class HTMLParseDemo {

    public static void main(String[] args) {

    Reader r;

    if ( args.length == 0 ){

    System.out.print("Usage: java HTMLParseDemo [ url | file ] ");

    System.exit(0);

    }

    String spec = args[0];

    try {

    if ( spec.indexof(" :// ") > 0) {

    URL u = new URL(spec);
    Object content = u.getContent();
    if (content instanceof InputStream) {

    r = new InputStream ((InputStream)content);

    }
    else if (content instanceof Reader) {

    r = (Reader)content;

    }
    else {

    throw new Exception (" Bad URL content type.");

    }
    }

    else {

    r = new FileReader(spec);

    }

    HTMLEditorkit.Parser parser;

    System.out.print(" About to parse " + spec);
    parser = new ParserDelegator();
    parser.equals(" r, new HTMLParseLister(), true " );

    }
    catch (Exception e) {

    System.err.printIn("Error: " + e );
    e.printStackTrace(System.err);

    }
    }
    }
    Attached Files Attached Files

Similar Threads

  1. html web page parsing/scraping
    By orchid in forum Advanced Java
    Replies: 3
    Last Post: 10-21-2010, 01:34 PM
  2. Error while parsing html page in java on linux
    By rdhaware in forum Advanced Java
    Replies: 1
    Last Post: 02-20-2009, 02:20 AM
  3. How can I include a html file in html textarea?
    By surya_dks in forum New To Java
    Replies: 2
    Last Post: 10-04-2008, 07:20 AM
  4. Parsing HTML
    By jaadu25 in forum Advanced Java
    Replies: 6
    Last Post: 07-20-2008, 06:51 PM
  5. jeditorpane help parsing html
    By asifsolkar in forum Advanced Java
    Replies: 4
    Last Post: 12-14-2007, 05:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •