Package org.custommonkey.xmlunit
Class HTMLDocumentBuilder.SwingEvent2SaxAdapter
- java.lang.Object
-
- javax.swing.text.html.HTMLEditorKit.ParserCallback
-
- org.custommonkey.xmlunit.HTMLDocumentBuilder.SwingEvent2SaxAdapter
-
- Enclosing class:
- HTMLDocumentBuilder
public class HTMLDocumentBuilder.SwingEvent2SaxAdapter extends HTMLEditorKit.ParserCallback
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
Constructors Constructor Description SwingEvent2SaxAdapter()Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidflush()Swing-HTML-parser template method, no ContentHandler equivalentvoidhandleComment(char[] data, int pos)Equivalent to Sax LexicalHandlercommentmethod.voidhandleEndTag(HTML.Tag tag, int pos)Equivalent to SaxendElementvoidhandleError(String errorMsg, int pos)Swing-HTML-parser template method, no ContentHandler equivalent.voidhandleSimpleTag(HTML.Tag tag, MutableAttributeSet attributeSet, int pos)Equivalent to SaxstartElementplusendElementvoidhandleStartTag(HTML.Tag tag, MutableAttributeSet attributeSet, int pos)Equivalent to SaxstartElementvoidhandleText(char[] data, int pos)Equivalent to Saxcharactersvoidparse(Reader reader, ContentHandler saxContentHandler)Perform Swing-HTML-parse-event-to-Sax-event conversion-
Methods inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback
handleEndOfLineString
-
-
-
-
Method Detail
-
parse
public void parse(Reader reader, ContentHandler saxContentHandler) throws SAXException, IOException
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
public void flush() throws BadLocationExceptionSwing-HTML-parser template method, no ContentHandler equivalent- Overrides:
flushin classHTMLEditorKit.ParserCallback- Throws:
BadLocationException
-
handleText
public void handleText(char[] data, int pos)Equivalent to Saxcharacters- Overrides:
handleTextin classHTMLEditorKit.ParserCallback
-
handleComment
public void handleComment(char[] data, int pos)Equivalent to Sax LexicalHandlercommentmethod. If the supplied ContentHandler is also an LexicalHandler then the cast will be made and the sax event passed on.- Overrides:
handleCommentin classHTMLEditorKit.ParserCallback
-
handleStartTag
public void handleStartTag(HTML.Tag tag, MutableAttributeSet attributeSet, int pos)
Equivalent to SaxstartElement- Overrides:
handleStartTagin classHTMLEditorKit.ParserCallback
-
handleEndTag
public void handleEndTag(HTML.Tag tag, int pos)
Equivalent to SaxendElement- Overrides:
handleEndTagin classHTMLEditorKit.ParserCallback
-
handleSimpleTag
public void handleSimpleTag(HTML.Tag tag, MutableAttributeSet attributeSet, int pos)
Equivalent to SaxstartElementplusendElement- Overrides:
handleSimpleTagin classHTMLEditorKit.ParserCallback
-
handleError
public void handleError(String errorMsg, int pos)
Swing-HTML-parser template method, no ContentHandler equivalent. These errors are generally recoverable, so they are logged.- Overrides:
handleErrorin classHTMLEditorKit.ParserCallback
-
-