A document that models HTML. The purpose of this model
is to support both browsing and editing. As a result,
the structure described by an HTML document is not
exactly replicated by default. The element structure that
is modeled by default, is built by the class
HTMLDocument.HTMLReader
, which implements
the
HTMLEditorKit.ParserCallback
protocol
that the parser expects. To change the structure one
can subclass
HTMLReader
, and reimplement the method
HTMLDocument.getReader(int)
to return the new reader
implementation. The documentation for
HTMLReader
should be consulted for the details of
the default structure created. The intent is that
the document be non-lossy (although reproducing the
HTML format may result in a different format).
The document models only HTML, and makes no attempt to
store view attributes in it. The elements are identified
by the StyleContext.NameAttribute
attribute,
which should always have a value of type HTML.Tag
that identifies the kind of element. Some of the elements
(such as comments) are synthesized. The HTMLFactory
uses this attribute to determine what kind of view to build.
This document supports incremental loading. The
TokenThreshold
property controls how
much of the parse is buffered before trying to update
the element structure of the document. This property
is set by the EditorKit
so that subclasses can disable
it.
The Base
property determines the URL
against which relative URLs are resolved.
By default, this will be the
Document.StreamDescriptionProperty
if
the value of the property is a URL. If a <BASE>
tag is encountered, the base will become the URL specified
by that tag. Because the base URL is a property, it
can of course be set directly.
The default content storage mechanism for this document
is a gap buffer (GapContent
).
Alternatives can be supplied by using the constructor
that takes a Content
implementation.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans
package.
Please see XMLEncoder
.