    All Packages    This Package    Previous    Next

# Class net.www.html.Document

    java.lang.Object
       |
       +----net.www.html.Document

public class Document
extends Object

net.ww.html.Document is a class which holds an html document. An html document is parsed text, a vector of tags, and optional html source text. Document is used by html.Parser to store parsed documents, but it is also used to help programatically generate html documents. E.g., the ftp protocol handler might generate an html document out of a directory listing.

##

htmlSource
  If this is non-null, it contains the htmlSource that this document was built from.
inPREelement
  This is whether or not we're in a <pre> section.
tags
  This is an array of tag references into the text string.
text
  This is the text of the html document, with the tags and extra white space removed.
title
  Title of this html document, or null if not known yet.

##

Document()

##

addTagRef(TagRef, int)
  This adds a pre-made TagRef to the document, and sets its position to the current position.
endTag(Tag, int)
  Create a new end tag ref at the current position.
getTags()
  Return the vector of tag refs.
getText()
  Return the text array.
getTitle()
  This returns the title for this document, as defined by the <title> </title> tag pairs.
reset()
setSource(String)
setText(byte[])
  Set the text array.
setText(String)
  Set the text.
startTag(Tag, int)
  Create a new start tag ref at the current position.

##

htmlSource

      protected String htmlSource

  If this is non-null, it contains the htmlSource that this document was built from.

text

      protected byte text[]

  This is the text of the html document, with the tags and extra white space removed.

tags

      protected Vector tags

  This is an array of tag references into the text string.

title

      protected String title

  Title of this html document, or null if not known yet.

inPREelement

      protected boolean inPREelement

  This is whether or not we're in a <pre> section. <pre> sections cannot be nested, and we enforce that here, so we don't need to keep a count.

##

Document

      public Document()

##

setSource

      public final void setSource(String source)

reset

      public void reset()

addTagRef

      protected final TagRef addTagRef(TagRef ref,
                                       int offset)

  This adds a pre-made TagRef to the document, and sets its position to the current position.

startTag

      public TagRef startTag(Tag t,
                             int offset)

  Create a new start tag ref at the current position. This creates a generic TagRef object, but can be subclassed to create specific TagRef subclasses.

endTag

      public TagRef endTag(Tag t,
                           int offset)

  Create a new end tag ref at the current position. This creates a generic TagRef object, but can be subclassed to create specific TagRef subclasses.

getTags

      public Vector getTags()

  Return the vector of tag refs.

getText

      public byte getText()

  Return the text array.

setText

      public void setText(byte text[])

  Set the text array. It is not copied.

setText

      public void setText(String str)

  Set the text.

getTitle

      public String getTitle()

  This returns the title for this document, as defined by the <title> </title> tag pairs. If no title is found, "" is returned.

    All Packages    This Package    Previous    Next