javax.swing.text.html

Class HTMLEditorKit.ParserCallback

public static class HTMLEditorKit.ParserCallback extends Object

The "hook" that receives all information about the HTML document structure while parsing it. The methods are invoked by parser and should be normally overridden.
Field Summary
static ObjectIMPLIED
If the tag does not occurs in the html stream directly, but is supposed by parser, the tag attribute set contains this additional attribute, having value Boolean.True.
Constructor Summary
ParserCallback()
Constructor
Method Summary
voidflush()
The parser calls this method after it finishes parsing the document.
voidhandleComment(char[] comment, int position)
Handle HTML comment, present in the given position.
voidhandleEndOfLineString(String end_of_line)
Notifies about the character sequences, used to separate lines in this document.
voidhandleEndTag(HTML.Tag tag, int position)
The method is called when the HTML closing tag ((like </table>) is found or if the parser concludes that the one should be present in the current position.
voidhandleError(String message, int position)
Handle the error.
voidhandleSimpleTag(HTML.Tag tag, MutableAttributeSet attributes, int position)
Handle the tag with no content, like <br>.
voidhandleStartTag(HTML.Tag tag, MutableAttributeSet attributes, int position)
The method is called when the HTML opening tag ((like <table>) is found or if the parser concludes that the one should be present in the current position.
voidhandleText(char[] text, int position)
Handle the text section.

Field Detail

IMPLIED

public static final Object IMPLIED
If the tag does not occurs in the html stream directly, but is supposed by parser, the tag attribute set contains this additional attribute, having value Boolean.True.

Constructor Detail

ParserCallback

public ParserCallback()
Constructor

Method Detail

flush

public void flush()
The parser calls this method after it finishes parsing the document.

handleComment

public void handleComment(char[] comment, int position)
Handle HTML comment, present in the given position.

Parameters: comment the comment

UNKNOWN: the position of the comment in the text being parsed.

handleEndOfLineString

public void handleEndOfLineString(String end_of_line)
Notifies about the character sequences, used to separate lines in this document. The parser calls this method after it finishes parsing the document, but before flush().

Parameters: end_of_line The "end of line sequence", one of: \r or \n or \r\n.

handleEndTag

public void handleEndTag(HTML.Tag tag, int position)
The method is called when the HTML closing tag ((like </table>) is found or if the parser concludes that the one should be present in the current position.

Parameters: tag The tag being handled position the tag position in the text being parsed.

handleError

public void handleError(String message, int position)
Handle the error.

Parameters: message The message, explaining the error. position The starting position of the fragment that has caused the error in the html document being parsed.

handleSimpleTag

public void handleSimpleTag(HTML.Tag tag, MutableAttributeSet attributes, int position)
Handle the tag with no content, like <br>. The method is called for the elements that, in accordance with the current DTD, has an empty content.

Parameters: tag The tag being handled. position The tag position in the text being parsed.

handleStartTag

public void handleStartTag(HTML.Tag tag, MutableAttributeSet attributes, int position)
The method is called when the HTML opening tag ((like <table>) is found or if the parser concludes that the one should be present in the current position.

Parameters: tag The tag being handled position The tag position in the text being parsed

handleText

public void handleText(char[] text, int position)
Handle the text section.

Parameters: text A section text. position The text position in the HTML document text being parsed.