View Single Post
  #2 (permalink)  
Old 07-24-2007, 02:29 AM
Heather Heather is offline
Senior Member
 
Join Date: Jun 2007
Posts: 164
Heather is on a distinguished road
try this:
Code:
import java.io.*; import javax.swing.text.*; import javax.swing.text.html.*; import javax.swing.text.html.parser.*; public class SEMMParse { //........ private class CallbackHandler extends HTMLEditorKit.ParserCallback { public void handleStartTag( HTML.Tag t, MutableAttributeSet a, int pos) { if (t==HTML.Tag.A && a!=null) { //do something with 'A' tags } } public void handleText( char[] data, int pos) { //do something } public void handleEndTag( HTML.Tag t, int pos) { } }//end CallbackHandler //....... //... somemethod() try { BufferedReader reader = new BufferedReader(new FileReader(path)); new ParserDelegator().parse ( reader, new CallbackHandler(), true ); } catch (IOException ioe) {ioe.printStackTrace(); } } }
Reply With Quote