public class HTMLDocumentBuilder.SwingEvent2SaxAdapter
extends javax.swing.text.html.HTMLEditorKit.ParserCallback
Modifier and Type | Field and Description |
---|---|
private org.xml.sax.helpers.AttributesImpl |
attributes |
private javax.swing.text.html.parser.ParserDelegator |
delegator |
private org.xml.sax.SAXException |
firstUnhandledException |
private static boolean |
IGNORE_HTML_CHAR_SET |
private boolean |
lastTagWasSimpleTag |
private org.xml.sax.ContentHandler |
saxContentHandler |
Constructor and Description |
---|
SwingEvent2SaxAdapter()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
private org.xml.sax.Attributes |
convertToSaxAttributes(javax.swing.text.MutableAttributeSet attributeSet)
Simple conversion method.
|
void |
flush()
Swing-HTML-parser template method, no ContentHandler equivalent
|
private int |
getStartIgnoringClosingSimpleTag(char[] data)
Adjusts the start offset into the character array for the fact that
the Swing HTML parser doesn't handle simple tags with explicit
closing angle brackets e.g.
|
void |
handleComment(char[] data,
int pos)
Equivalent to Sax LexicalHandler
comment method. |
void |
handleEndTag(javax.swing.text.html.HTML.Tag tag,
int pos)
Equivalent to Sax
endElement |
void |
handleError(java.lang.String errorMsg,
int pos)
Swing-HTML-parser template method, no ContentHandler equivalent.
|
private void |
handleSAXException(org.xml.sax.SAXException e)
Log an error from the ContentHandler for raising post-parse
|
void |
handleSimpleTag(javax.swing.text.html.HTML.Tag tag,
javax.swing.text.MutableAttributeSet attributeSet,
int pos)
Equivalent to Sax
startElement plus
endElement |
void |
handleStartTag(javax.swing.text.html.HTML.Tag tag,
javax.swing.text.MutableAttributeSet attributeSet,
int pos)
Equivalent to Sax
startElement |
void |
handleText(char[] data,
int pos)
Equivalent to Sax
characters |
void |
parse(java.io.Reader reader,
org.xml.sax.ContentHandler saxContentHandler)
Perform Swing-HTML-parse-event-to-Sax-event conversion
|
private void |
postParse()
Equivalent to Sax
endDocument |
private void |
preParse()
Equivalent to Sax
startDocument |
private static final boolean IGNORE_HTML_CHAR_SET
private final org.xml.sax.helpers.AttributesImpl attributes
private final javax.swing.text.html.parser.ParserDelegator delegator
private boolean lastTagWasSimpleTag
private org.xml.sax.ContentHandler saxContentHandler
private org.xml.sax.SAXException firstUnhandledException
public void parse(java.io.Reader reader, org.xml.sax.ContentHandler saxContentHandler) throws org.xml.sax.SAXException, java.io.IOException
org.xml.sax.SAXException
java.io.IOException
private void preParse() throws org.xml.sax.SAXException
startDocument
org.xml.sax.SAXException
private void postParse() throws org.xml.sax.SAXException
endDocument
org.xml.sax.SAXException
- if any SAXExceptions have occurred during
parsingpublic void flush() throws javax.swing.text.BadLocationException
flush
in class javax.swing.text.html.HTMLEditorKit.ParserCallback
javax.swing.text.BadLocationException
public void handleText(char[] data, int pos)
characters
handleText
in class javax.swing.text.html.HTMLEditorKit.ParserCallback
private int getStartIgnoringClosingSimpleTag(char[] data)
data
- public void handleComment(char[] data, int pos)
comment
method.
If the supplied ContentHandler is also an LexicalHandler then the
cast will be made and the sax event passed on.handleComment
in class javax.swing.text.html.HTMLEditorKit.ParserCallback
public void handleStartTag(javax.swing.text.html.HTML.Tag tag, javax.swing.text.MutableAttributeSet attributeSet, int pos)
startElement
handleStartTag
in class javax.swing.text.html.HTMLEditorKit.ParserCallback
public void handleEndTag(javax.swing.text.html.HTML.Tag tag, int pos)
endElement
handleEndTag
in class javax.swing.text.html.HTMLEditorKit.ParserCallback
public void handleSimpleTag(javax.swing.text.html.HTML.Tag tag, javax.swing.text.MutableAttributeSet attributeSet, int pos)
startElement
plus
endElement
handleSimpleTag
in class javax.swing.text.html.HTMLEditorKit.ParserCallback
public void handleError(java.lang.String errorMsg, int pos)
handleError
in class javax.swing.text.html.HTMLEditorKit.ParserCallback
private org.xml.sax.Attributes convertToSaxAttributes(javax.swing.text.MutableAttributeSet attributeSet)
attributeSet
- private void handleSAXException(org.xml.sax.SAXException e)