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.
Printable View
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.
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
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
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.
Francojava1 is needing urgent reply from you about HTMLEditorkit.Parser codes because Iam going to compile these codes for you . Tell me please .Thanks
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);
}
}
}