|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.text.html.HTMLEditorKit.ParserCallback edu.northwestern.at.utils.swing.html.HTMLStripper
public class HTMLStripper
Strips HTML tags.
Tags which cause line breaks such as <br>, <p>, etc. when the HTML is displayed are converted to user-specified line separator characters.
Field Summary |
---|
Fields inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback |
---|
IMPLIED |
Constructor Summary | |
---|---|
HTMLStripper(java.io.Writer out)
Create HTML stripper using default end of line separator. |
|
HTMLStripper(java.io.Writer out,
java.lang.String lineSeparator)
Create stripper using default end of line separator. |
Method Summary | |
---|---|
void |
handleEndTag(javax.swing.text.html.HTML.Tag tag,
int position)
Handles an end tag (<br>, <p>, etc.) |
void |
handleSimpleTag(javax.swing.text.html.HTML.Tag tag,
javax.swing.text.MutableAttributeSet attributes,
int position)
Handles simple tags. |
void |
handleText(char[] text,
int position)
Handles ordinary text in HTML input. |
Methods inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback |
---|
flush, handleComment, handleEndOfLineString, handleError, handleStartTag |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HTMLStripper(java.io.Writer out)
out
- Writer to which stripped text will be written. public HTMLStripper(java.io.Writer out, java.lang.String lineSeparator)
out
- Writer to which stripped text will be written.lineSeparator
- Characters to separate lines. Method Detail |
---|
public void handleText(char[] text, int position)
handleText
in class javax.swing.text.html.HTMLEditorKit.ParserCallback
text
- The text.position
- Position of the text in the file
(not used here).
This is plain text, so it is written as it stands to the output.
public void handleEndTag(javax.swing.text.html.HTML.Tag tag, int position)
handleEndTag
in class javax.swing.text.html.HTMLEditorKit.ParserCallback
tag
- The end tag.position
- Position of the tag in the file
(not used here).
For a block type tag (e.g., <p>) two sets of line separator characters are written. For a text break tag (e.g., <br>) a single set of line separator characters is written.
public void handleSimpleTag(javax.swing.text.html.HTML.Tag tag, javax.swing.text.MutableAttributeSet attributes, int position)
handleSimpleTag
in class javax.swing.text.html.HTMLEditorKit.ParserCallback
tag
- The simple tag.attributes
- Tag attributes.position
- Position of the tag in the file
(not used here).
For a block type tag (e.g., <p>) two sets of line separator characters are written. For a text break tag (e.g., <br>) a single set of line separator characters is written. For all other tags, a single blank is output.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |