Generated by

javax.swing.text.html.parser Documentation Differences

This file contains all the changes in documentation in the package javax.swing.text.html.parser as colored differences. Deletions are shown like this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.

Class AttributeList

This class defines the attributes of an SGML element as described in a DTD using the ATTLIST construct. An AttributeList can be obtained from the Element class using the getAttributes() method.

It is actually an element in a linked list. Use the getNext() method repeatedly to enumerate all the attributes of an element. @see Element @author Arthur Van Hoff @version 1.6 028 12/0203/0001

Class AttributeList, int getModifier()

@return attribute modifermodifier @see DTDConstants

Class ContentModel

A representation of a content model. A content model is basically a restricted BNF expression. It is restricted in the sense that it must be deterministic. This means that you don't have to represent it as a finite state automata.

See Annex H on page 556 of the SGML handbook for more information. @author Arthur van Hoff @version 1.6 028 12/0203/0001

Class DTD

The representation of an SGML DTD. This is produced by the DTDParser. The resulting DTD object describes a document syntax and is neededused toin parsing parserof HTML documents using the Parser. It contains a list of elements and their attributes as well as a list of entities defined in the DTD. @see Element @see AttributeList @see ContentModel @see DTDParser @see Parser @author Arthur van Hoff @version 1.10 0214 12/0203/0001
Class DTD, constructor DTD(String)

CreateCreates a new DTD with the specified name. @param name the name as a String of the new DTD
Class DTD, AttributeList defAttributeList(String, int, int, String, String, AttributeList)

DefineCreates and returns an AttributeList. @param name the attribute list's name @return the new AttributeList
Class DTD, ContentModel defContentModel(int, Object, ContentModel)

DefineCreates and returns a new content model. @param type the type of the new content model @return the new ContentModel
Class DTD, Element defElement(String, int, boolean, boolean, ContentModel, String[], String[], AttributeList)

DefineCreates and returns an elementElement. @param the element's name @return the new Element
Class DTD, Entity defEntity(String, int, String)

DefineCreates and returns an entityEntity. @param name the entity's name @return the new Entity
Class DTD, Entity defEntity(String, int, int)

DefineCreates and returns a character entityEntity. @param name the entity's name @return the new character Entity
Class DTD, void defineAttributes(String, AttributeList)

DefineReturns the attributesElement ofwhich matches the specified AttributeList. If one doesn't anexist elementa new one is created and returned. @param name the name of the Element @param atts the AttributeList specifying the Element @return the Element specified
Class DTD, Element defineElement(String, int, boolean, boolean, ContentModel, BitSet, BitSet, AttributeList)

Define anReturns the elementElement which matches the specified parameters. If one doesn't exist a new one is created and returned. @param name the name of the Element @param type the type of the Element @param omitStart truetrue if end should be omitted @param content the ContentModel @param atts the AttributeList specifying the Element @return the Element specified
Class DTD, Entity defineEntity(String, int, char[])

DefineDefines an entity. If the Entity specified by name type and data exists it is returned; otherwise a new Entity is created and is returned. @param name the name of the Entity as a String @param type the type of the Entity @param data the Entity's data @return the Entity requested or a new Entity if not found
Class DTD, DTD getDTD(String)

GetReturns a DTD with the specified name. If a DTD with that name doesn't exist one is created and returned. Any uppercase characters in the name are converted to lowercase. @param the name of the DTD @return the DTD which corresponds to name
Class DTD, Element getElement(String)

GetGets an element by name. A new element is created if the element doesn't exist. @param name the requested String @return the Element corresponding to name which may be newly created
Class DTD, Element getElement(int)

GetGets an element by index. @param index the requested index @return the Element corresponding to index
Class DTD, Entity getEntity(String)

GetGets an entity by name. @return the Entity corresponding to the name String
Class DTD, Entity getEntity(int)

GetGets a character entity. @return the Entity corresponding to the ch character
Class DTD, String getName()

GetGets the name of the DTD. @return the name of the DTD
Class DTD, String toString()

ReturnReturns a string representation of this DTD. @return the string representation of this DTD

Class DTDConstants

SGML constants used in a DTD. The names of the constants correspond the the equivalent SGML constructs as described in "The SGML Handbook" by Charles F. Goldfarb. @see DTD @see Element @version 1.7 028 12/0203/0001 @author Arthur van Hoff

Class DocumentParser

A Parser for HTML Documents (actually you can specify a DTD but you should really only use this class with the html dtd in swing). Reads an InputStream of HTML and invokes the appropriate methods in the ParserCallback class. This is the default parser used by HTMLEditorKit to parse HTML url's.

This will message the callback for all valid tags as well as tags that are implied but not explicitly specified. For example the html string (<p>blah) only has a p tag defined. The callback will see the following methods:

  1. handleStartTag(html ...)
  2. handleStartTag(head ...)
  3. handleEndTag(head)
  4. handleStartTag(body ...)
  5. handleStartTag(p ...)
  6. handleText(...)
  7. handleEndTag(p)
  8. handleEndTag(body)
  9. handleEndTag(html)
The items in italic are implied that is although they were not explicitly specified to be correct html they should have been present (head isn't necessary but it is still generated). For tags that are implied the AttributeSet argument will have a value of Boolean.TRUE for the key HTMLEditorKit.ParserCallback.IMPLIED.

HTML.Attributes defines a type safe enumeration of html attributes. If an attribute key of a tag is defined in HTML.Attribute the HTML.Attribute will be used as the key otherwise a String will be used. For example <p foo=bar class=neat> has two attributes. foo is not defined in HTML.Attribute where as class is therefore the AttributeSet will have two values in it HTML.Attribute.CLASS with a String value of 'neat' and the String key 'foo' with a String value of 'bar'.

The position argument will indicate the start of the tag comment or text. Similiar to arrays the first character in the stream has a position of 0. For tags that are implied the position will indicate the location of the next encountered tag. In the first example the implied start body and html tags will have the same position as the p tag and the implied end p html and body tags will all have the same position.

As html skips whitespace the position for text will be the position of the first valid character eg in the string '\n\n\nblah' the text 'blah' will have a position of 3 the newlines are skipped.

For attributes that do not have a value eg in the html string <foo blah> the attribute blah does not have a value there are two possible values that will be placed in the AttributeSet's value:

Once the stream has been parsed the callback is notified of the most likely end of line string. The end of line string will be one of \n \r or \r\n which ever is encountered the most in parsing the stream. @version 1.22 0223 12/0203/0001 @author Sunita Mani

Class Element

An element as described in a DTD using the ELEMENT construct. This is essentiall the description of a tag. It describes the type content model attributes attribute types etc. It is used to correctly parse a document by the Parser. @see DTD @see AttributeList @version 1.6 027 12/0203/0001 @author Arthur van Hoff

Class Entity

An entity in asis described in a DTD using the ENTITY construct. It defines the type and value of the the entity. @see DTD @version 1.6 028 12/0203/0001 @author Arthur van Hoff
Class Entity, constructor Entity(String, int, char[])

CreateCreates an entity. @param name the name of the entity @param type the type of the entity @param data the char array of data
Class Entity, char[] getData()

ReturnReturns the data. @return the data
Class Entity, String getName()

GetGets the name of the entity. @return the name of the entity as a String
Class Entity, String getString()

ReturnReturns the data as a stringString. @return the data as a String
Class Entity, int getType()

GetGets the type of the entity. @return the type of the entity
Class Entity, boolean isGeneral()

ReturnReturns true if it is a parametergeneral entity. @return true if it is a general entity
Class Entity, boolean isParameter()

ReturnReturns true if it is a parameter entity. @return true if it is a parameter entity

Class Parser

A simple DTD-driven HTML parser. The parser reads an HTML file from an InputStream and calls various methods (which should be overridden in a subclass) when tags and data are encountered.

Unfortunately there are many badly implemented HTML parsers out there and as a result there are many badly formatted HTML files. This parser attempts to parse most HTML files. This means that the implementation sometimes deviates from the SGML specification in favor of HTML.

The parser treats \r and \r\n as \n. Newlines after starttags and before end tags are ignored just as specified in the SGML/HTML specification.

The html spec does not specify how spaces are to be coalesced very well. Specifically the following scenarios are not discussed (note that a space should be used here but I am using &nbsp to force the space to be displayed):

'<b>blah <i> <strike> foo' which can be treated as: '<b>blah <i><strike>foo'

as well as: '<p><a href="xx"> <em>Using</em></a></p>' which appears to be treated as: '<p><a href="xx"><em>Using</em></a></p>'

If strict is false when a tag that breaks flow (TagElement.breaksFlows) or trailing whitespace is encountered all whitespace will be ignored until a non whitespace character is encountered. This appears to give behavior closer to the popular browsers. @see DTD @see TagElement @see SimpleAttributeSet @version 1.24 0228 12/0203/0001 @author Arthur van Hoff @author Sunita Mani

Class ParserDelegator

Responsible for starting up a new DocumentParser each time its parse method is invoked. Stores a reference to the dtd. @author Sunita Mani @version 1.8 0212 12/0203/0001

Class TagElement

A generic HTML TagElement class. The methods define how white space is interpreted around the tag. @version 1.8 029 12/0203/0001 @author Sunita Mani