public static void main(String[] args) throws Exception
{
// (1.) read html file to string
FileReader fr = new FileReader("test.html");
BufferedReader br = new BufferedReader(fr);
StringBuffer sb = new StringBuffer();
String line = null;
while(true)
{
line = br.readLine();
if (line == null)
break; // reach the end of file
sb.append(line);
}
br.close();
fr.close();
// (2.) parse html string
HtmlParser hp=new HtmlParser();
ParseUnit[] pu=hp.parseString(sb.toString());