How I Read The HTML Tag from HTML File,

Hi guysI wants read/get the html Tag of html file.Plz help me.
[97 byte] By [delhia] at [2007-10-2 21:55:34]
# 1
http://java-source.net/open-source/html-parsers
quittea at 2007-7-14 1:11:36 > top of Java-index,Java Essentials,Java Programming...
# 2

Thanks Guitte,

Plz tell me how I read my html file with this API.

I am reading the HTML file Like That-

String filename = "c:\text.html";

BufferedReader input = null;

input = new BufferedReader( new FileReader(filename) );

String line = null;

while (( line = input.readLine()) != null)

{

String str="";

int index=0;

while(index<line.length())

{

char c = line.charAt(index++);

String strchar = String.valueOf(c);

}

}

How we use your API with this code.

If another way to read this then tell me.>

delhia at 2007-7-14 1:11:36 > top of Java-index,Java Essentials,Java Programming...
# 3

Depends on which one of the APIs you use--the link I gave refers to a collection of different HTML parsers. The code you posted looks like a first step to a parser of your own. So you can a) use an external API and feed it what it wants (File, URL, String ... depends) or b) proceed with your code and implement a minimum of a parser in order to achieve your aim.

What are you trying to achieve with your program?

quittea at 2007-7-14 1:11:36 > top of Java-index,Java Essentials,Java Programming...
# 4
I have use this on OnLine application. I am trying to convert html file to Pdf file, when we pass a url of html fileand press a button then convert this HTML file in PDF file.//Nitin
delhia at 2007-7-14 1:11:36 > top of Java-index,Java Essentials,Java Programming...
# 5

If you use JTidy (http://jtidy.sourceforge.net/) for instance, you can have it parse HTML delivered by an InputStream, e.g.:

Document doc = new Tidy().parseDom(url.openStream(),null);

This doc can be transformed into Formatting Objects (FO) style and finally into a PDF (http://xmlgraphics.apache.org/fop/).

quittea at 2007-7-14 1:11:36 > top of Java-index,Java Essentials,Java Programming...
# 6
I m not understanding how this work.PLZ Tell me briefly.
delhia at 2007-7-14 1:11:36 > top of Java-index,Java Essentials,Java Programming...
# 7

The raw process is as follows:

(HTML) -- JTidy --> (XML-DOM) -- XSLT --> (XML-FO) -- FOP --> (PDF)

For the details, there's too much technical stuff about how to use the respective tools/APIs for this place. You should look for a more specialized community place. Here's a link to give you a start:

http://wiki.apache.org/xmlgraphics-fop/HowTo/HtmlToPdf

quittea at 2007-7-14 1:11:36 > top of Java-index,Java Essentials,Java Programming...
# 8
I am using iText API to convert html to PDF.But I am not able to get html tag serial wise.
delhia at 2007-7-14 1:11:36 > top of Java-index,Java Essentials,Java Programming...