|PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES|
This file contains all the changes in documentation in the package
javax.swing.text.html.parseras 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.
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.Class AttributeList, int getModifier()
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
modifermodifier @see DTDConstants
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
The representation of an SGML DTD.Class DTD, constructor DTD(String)
This is produced by the DTDParser. The resultingDTD objectdescribes 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 @seeParser @author Arthur van Hoff @version 1. 10 0214 12/ 0203/ 0001
Class DTD, AttributeList defAttributeList(String, int, int, String, String, AttributeList)
CreateCreates a new DTD with the specified name. @param name the name as a
Stringof the new DTD
Class DTD, ContentModel defContentModel(int, Object, ContentModel)
DefineCreates and returns an
AttributeList. @param name the attribute list's name @return the new
Class DTD, Element defElement(String, int, boolean, boolean, ContentModel, String, String, AttributeList)
DefineCreates and returns a new content model. @param type the type of the new content model @return the new
Class DTD, Entity defEntity(String, int, String)
DefineCreates and returns an element
Element. @param the element's name @return the new
Class DTD, Entity defEntity(String, int, int)
DefineCreates and returns an entity
Entity. @param name the entity's name @return the new
Class DTD, void defineAttributes(String, AttributeList)
DefineCreates and returns a character entity
Entity. @param name the entity's name @return the new character
Class DTD, Element defineElement(String, int, boolean, boolean, ContentModel, BitSet, BitSet, AttributeList)
DefineReturns the attributes
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
Class DTD, Entity defineEntity(String, int, char)
Define anReturns the element
Elementwhich 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
truetrue if end should be omitted @param content the
ContentModel@param atts the
Class DTD, DTD getDTD(String)
DefineDefines an entity. If the
dataexists it is returned; otherwise a new
Entityis created and is returned. @param name the name of the
String@param type the type of the
Entity@param data the
Entity's data @return the
Entityrequested or a new
Entityif not found
Class DTD, Element getElement(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
Class DTD, Element getElement(int)
GetGets an element by name. A new element is created if the element doesn't exist. @param name the requested
namewhich may be newly created
Class DTD, Entity getEntity(String)
GetGets an element by index. @param index the requested index @return the
Class DTD, Entity getEntity(int)
GetGets an entity by name. @return the
Entitycorresponding to the
Class DTD, String getName()
GetGets a character entity. @return the
Entitycorresponding to the
Class DTD, String toString()
GetGets the name of the DTD. @return the name of the DTD
ReturnReturns a string representation of this DTD. @return the string representation of this DTD
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
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:
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
- handleStartTag(html ...)
- handleStartTag(head ...)
- handleStartTag(body ...)
- handleStartTag(p ...)
Boolean.TRUEfor the key
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
blahdoes not have a value there are two possible values that will be placed in the AttributeSet's value:
- If the DTD does not contain an definition for the element or the definition does not have an explicit value then the value in the AttributeSet will be
- If the DTD contains an explicit value as in:
< ATTLIST OPTION selected (selected) #IMPLIED>this value from the dtd (in this case selected) will be used.
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
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
An entityClass Entity, constructor Entity(String, int, char)
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, char getData()
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, String getName()
data. @return the
Class Entity, String getString()
GetGets the name of the entity. @return the name of the entity as a
Class Entity, int getType()
ReturnReturns the data as a string
String. @return the data as a
Class Entity, boolean isGeneral()
GetGets the type of the entity. @return the type of the entity
Class Entity, boolean isParameter()
trueif it is a
parametergeneral entity. @return
trueif it is a general entity
trueif it is a parameter entity. @return
trueif it is a parameter entity
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   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@see DTD @see TagElement @see SimpleAttributeSet @version 1.
strictis 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.
24 0228 12/ 0203/ 0001 @author Arthur van Hoff @author Sunita Mani
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
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