Tag Stripping Example, Part II

// Begin by retrieving a parser using the ParserGetter class:
    ParserGetter kit = new ParserGetter();
    HTMLEditorKit.Parser parser = kit.getParser();
// Next, construct an instance of your callback class like this:

    HTMLEditorKit.ParserCallback callback 
     = new TagStripper(new OutputStreamWriter(System.out));
// Then get a stream you can read the HTML document from. For example, 

    try {
      URL u = new URL("http://www.oreilly.com");
      InputStream in = u.openStream();
      InputStreamReader r = new InputStreamReader(in);

// Finally, pass the Reader and HTMLEditorKit.ParserCallback to the 
// HTMLEditorKit.Parser's parse() method, like this:

      parser.parse(r, callback, false);
    catch (IOException e) {

Previous | Next | Top | Cafe con Leche

Copyright 2000 Elliotte Rusty Harold
Last Modified January 23, 2000