Class HTMLDocumentBuilder.SwingEvent2SaxAdapter

  • Enclosing class:
    HTMLDocumentBuilder

    public class HTMLDocumentBuilder.SwingEvent2SaxAdapter
    extends javax.swing.text.html.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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void flush()
      Swing-HTML-parser template method, no ContentHandler equivalent
      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.
      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
      • Methods inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback

        handleEndOfLineString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SwingEvent2SaxAdapter

        public SwingEvent2SaxAdapter()
        Default constructor
    • Method Detail

      • parse

        public void parse​(java.io.Reader reader,
                          org.xml.sax.ContentHandler saxContentHandler)
                   throws org.xml.sax.SAXException,
                          java.io.IOException
        Perform Swing-HTML-parse-event-to-Sax-event conversion
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
      • flush

        public void flush()
                   throws javax.swing.text.BadLocationException
        Swing-HTML-parser template method, no ContentHandler equivalent
        Overrides:
        flush in class javax.swing.text.html.HTMLEditorKit.ParserCallback
        Throws:
        javax.swing.text.BadLocationException
      • handleText

        public void handleText​(char[] data,
                               int pos)
        Equivalent to Sax characters
        Overrides:
        handleText in class javax.swing.text.html.HTMLEditorKit.ParserCallback
      • handleComment

        public void handleComment​(char[] data,
                                  int pos)
        Equivalent to Sax LexicalHandler comment method. If the supplied ContentHandler is also an LexicalHandler then the cast will be made and the sax event passed on.
        Overrides:
        handleComment in class javax.swing.text.html.HTMLEditorKit.ParserCallback
      • handleStartTag

        public void handleStartTag​(javax.swing.text.html.HTML.Tag tag,
                                   javax.swing.text.MutableAttributeSet attributeSet,
                                   int pos)
        Equivalent to Sax startElement
        Overrides:
        handleStartTag in class javax.swing.text.html.HTMLEditorKit.ParserCallback
      • handleEndTag

        public void handleEndTag​(javax.swing.text.html.HTML.Tag tag,
                                 int pos)
        Equivalent to Sax endElement
        Overrides:
        handleEndTag in class javax.swing.text.html.HTMLEditorKit.ParserCallback
      • handleSimpleTag

        public void handleSimpleTag​(javax.swing.text.html.HTML.Tag tag,
                                    javax.swing.text.MutableAttributeSet attributeSet,
                                    int pos)
        Equivalent to Sax startElement plus endElement
        Overrides:
        handleSimpleTag in class javax.swing.text.html.HTMLEditorKit.ParserCallback
      • handleError

        public void handleError​(java.lang.String errorMsg,
                                int pos)
        Swing-HTML-parser template method, no ContentHandler equivalent. These errors are generally recoverable, so they are logged.
        Overrides:
        handleError in class javax.swing.text.html.HTMLEditorKit.ParserCallback