O'Reilly logo

Inside XML by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Windowed Browser

We wrote the indenting parser example to store the display text in an array named displayStrings, so it's easy to display that text in a Java window as we did in the previous chapter. To do that, I'll create a new example named browserSAX.java; in this program, I create a new object of a class I'll call AppFrame. Then I pass displayStrings and the number of lines to display to the AppFrame class's constructor, and then call the AppFrame object's show method to show the window:

 import java.awt.*; import java.awt.event.*; import org.apache.xerces.parsers.SAXParser; import org.xml.sax.*; import org.xml.sax.helpers.DefaultHandler; public class browserSAX extends DefaultHandler { . . . public static void main(String args[]) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required