Package org.custommonkey.xmlunit
Class HTMLDocumentBuilder.SwingEvent2SaxAdapter
java.lang.Object
javax.swing.text.html.HTMLEditorKit.ParserCallback
org.custommonkey.xmlunit.HTMLDocumentBuilder.SwingEvent2SaxAdapter
- Enclosing class:
- HTMLDocumentBuilder
Adapts Swing HTML callback messages to Sax equivalents, passing them
to a Sax-aware ContentHandler.
-
Field Summary
Fields inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback
IMPLIED
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
flush()
Swing-HTML-parser template method, no ContentHandler equivalentvoid
handleComment
(char[] data, int pos) Equivalent to Sax LexicalHandlercomment
method.void
handleEndTag
(HTML.Tag tag, int pos) Equivalent to SaxendElement
void
handleError
(String errorMsg, int pos) Swing-HTML-parser template method, no ContentHandler equivalent.void
handleSimpleTag
(HTML.Tag tag, MutableAttributeSet attributeSet, int pos) Equivalent to SaxstartElement
plusendElement
void
handleStartTag
(HTML.Tag tag, MutableAttributeSet attributeSet, int pos) Equivalent to SaxstartElement
void
handleText
(char[] data, int pos) Equivalent to Saxcharacters
void
parse
(Reader reader, ContentHandler saxContentHandler) Perform Swing-HTML-parse-event-to-Sax-event conversionMethods inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback
handleEndOfLineString
-
Constructor Details
-
SwingEvent2SaxAdapter
public SwingEvent2SaxAdapter()Default constructor
-
-
Method Details
-
parse
Perform Swing-HTML-parse-event-to-Sax-event conversion- Parameters:
reader
- reader to read the document fromsaxContentHandler
- content handler receiving SAX events while parsing the document- Throws:
SAXException
- if the parser feels like itIOException
- on I/O errors
-
flush
Swing-HTML-parser template method, no ContentHandler equivalent- Overrides:
flush
in classHTMLEditorKit.ParserCallback
- Throws:
BadLocationException
-
handleText
public void handleText(char[] data, int pos) Equivalent to Saxcharacters
- Overrides:
handleText
in classHTMLEditorKit.ParserCallback
-
handleComment
public void handleComment(char[] data, int pos) Equivalent to Sax LexicalHandlercomment
method. If the supplied ContentHandler is also an LexicalHandler then the cast will be made and the sax event passed on.- Overrides:
handleComment
in classHTMLEditorKit.ParserCallback
-
handleStartTag
Equivalent to SaxstartElement
- Overrides:
handleStartTag
in classHTMLEditorKit.ParserCallback
-
handleEndTag
Equivalent to SaxendElement
- Overrides:
handleEndTag
in classHTMLEditorKit.ParserCallback
-
handleSimpleTag
Equivalent to SaxstartElement
plusendElement
- Overrides:
handleSimpleTag
in classHTMLEditorKit.ParserCallback
-
handleError
Swing-HTML-parser template method, no ContentHandler equivalent. These errors are generally recoverable, so they are logged.- Overrides:
handleError
in classHTMLEditorKit.ParserCallback
-