Chapter 32. The javax.swing.text.html.parser Package

This package includes classes and interfaces for parsing HTML text.
The parser is configured by a DTD (document type definition) and is
therefore customizable. The parser conforms to the
HTMLEditorKit.Parser and
HTMLEditorKit.ParserCallback interfaces defined in
the javax.swing.text.html package. Most
applications can ignore this package and simply use
javax.swing.JEditorPane and
javax.swing.text.html.HTMLEditorKit to handle their
HTML parsing and display needs.
Figure 32-1 shows the class hierarchy of
this package.

Figure 32-1. The javax.swing.text.html.parser package

AttributeList

Java 1.2

javax.swing.text.html.parser

serializable

This class is an element in a linked list of attribute
specifications. The complete list of attribute specifications
represents an ATTLIST element of a DTD. Each
AttributeList object represents the name, type, and
values of a single attribute. Use the getNext()
method to obtain the next AttributeList object in
the linked list.

This Parser subclass is the delegate of the
ParserDelegator class. The
parse() method reads a document from the specified
Reader stream, parses it using the DTD specified
when the DocumentParser was created, and notifies
the specified HTMLEditorKit.ParserCallback object
of the document structure by calling its various methods.

This class represents a document type definition (DTD). A DTD
specifies the grammar of the document to be parsed. The methods of
this class allow you to define the elements and entities of the
grammar and look those elements and entities up by name. It also
defines a read() method that can read a DTD stored
in a binary format. ParserDelegator reads the
default HTML 3.2 DTD from the file html32.bdtd,
which is stored in the same directory or ZIP archive as the
DTD.class class file.

This class represents an ENTITY specification in a
DTD. It specifies the name, type, and value of the entity.

public final class Entity implements DTDConstants {

//

Public Constructors

public Entity (String name, int type, char[ ] data);

//

Public Class Methods

public static int name2type (String nm);

//

Property Accessor Methods (by property name)

public char[ ] getData ();

public boolean isGeneral ();

public String getName ();

public boolean isParameter ();

public String getString ();

public int getType ();

//

Public Instance Fields

public char[ ] data ;

public String name ;

public int type ;

}

Hierarchy: Object-->Entity(DTDConstants)

Returned By: DTD.{defEntity(), defineEntity(), getEntity()}

Parser

Java 1.2

javax.swing.text.html.parser

This class is an HTML parser that uses a DTD object
to specify the specific HTML grammar it should parse. The
parse() method reads HTML text from a stream and
parses it. Parser calls its various protected
methods at appropriate points during the parsing process. In order to
do anything useful, a subclass must provide non-empty implementations
for these methods. See also DocumentParser.

This class extends the HTMLEditorKit.Parser
class and provides a definition of the parse() method,
which reads HTML text from a stream and parses it into a sequence of
calls to the methods of the specified
HTMLEditorKit.ParserCallback object. Each time
parse() is called, the
ParserDelegator class creates a new instance of
DocumentParser to perform the parsing and maintain
state for the parsing process.