Allora per la lettura del file ho fatto cosi':
codice:
int i;
StringBuffer sb = new StringBuffer ();
String fpath="c:/prova.htm";
DataInputStream is = new DataInputStream ( new FileInputStream (fpath));
BufferedReader br=new BufferedReader(new InputStreamReader(is));
do{
i=br.read();
System.out.println((char)i);
sb.append(i);
}while (i!=-1);
is.close();
Quindi ora basta mettere sb al posto di html?:
codice:
Pattern pattern = Pattern.compile("<a href=\"(.*?)\">(.*?)</a>");
Matcher matcher = pattern.matcher(sb);
while (matcher.find()) {
System.out.println("href=" + matcher.group(1) + " - contenuto=" + matcher.group(2));
}
}
Ad andare va pero' non mi restituisce nulla.....