I use htmlparser http://htmlparser.sourceforge.net/javadoc/index.html

M

mike

regards:

I use htmlparser http://htmlparser.sourceforge.net/javadoc/index.html
to parse existing File test.htm
and output to test2.txt.

"javac ToHtmlDemo" is ok.
but when
"java ToHtmlDemo"

exception say
encoding change from ISO-8859-1 to Big5
----------------------------------


Do I miss something important?
Followings is my code.

thank you
May god be with you.

----------------------------------


import org.htmlparser.Parser;
import org.htmlparser.util.NodeIterator;
import org.htmlparser.util.ParserException;
import java.io.*;


public class ToHtmlDemo
{
public static void main (String[] args) throws ParserException
{
try{

FileOutputStream htmlparserOutput = new
FileOutputStream("test2.txt");
PrintWriter out=null;
out = new PrintWriter(htmlparserOutput);
Parser parser = new Parser ("test.htm");
for (NodeIterator i = parser.elements();i.hasMoreNodes();){
out.print(i.nextNode().toHtml ());}
out.close();
htmlparserOutput.close();
}
catch(IOException e)
{
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top