import javax.swing.text.*;
import javax.swing.text.html.*;
import javax.swing.text.html.parser.*;
import java.net.*;
import java.io.*;



public class HTMLParse extends HTMLEditorKit.ParserCallback {
    public void handleText(char[] data, int pos) {
     System.out.println(data);
     }

    public void handleStartTag(HTML.Tag t, 
                MutableAttributeSet a, 
                int pos) {
      System.out.println("+" + t.toString());
      }

    public void handleSimpleTag(HTML.Tag t, 
            MutableAttributeSet a,
            int pos) {
        System.out.println("*" + t.toString());
    }

    public void handleEndTag(HTML.Tag t, int pos) {
        System.out.println("-" + t.toString());
    }

    public static void main(String args[]) throws Exception {
   URL url=new URL(args[0]);
   Reader reader = new InputStreamReader((InputStream)url.getContent());
   new ParserDelegator().parse(reader, new HTMLParse(), false);
    }
}
