Class StripHtmlTagAdapter

  • All Implemented Interfaces:
    TagVisitor

    public class StripHtmlTagAdapter
    extends TagAdapter
    Strips all non-important characters from HTML. Script and style blocks are not stripped, just HTML text blocks and comments.
    • Field Detail

      • strippedCharsCount

        protected int strippedCharsCount
      • strip

        protected boolean strip
    • Constructor Detail

      • StripHtmlTagAdapter

        public StripHtmlTagAdapter​(TagVisitor target)
    • Method Detail

      • start

        public void start()
        Description copied from interface: TagVisitor
        Invoked on very beginning of the visiting.
        Specified by:
        start in interface TagVisitor
        Overrides:
        start in class TagAdapter
      • comment

        public void comment​(java.lang.CharSequence comment)
        Skips HTML comments.
        Specified by:
        comment in interface TagVisitor
        Overrides:
        comment in class TagAdapter
      • tag

        public void tag​(Tag tag)
        Description copied from interface: TagVisitor
        Invoked on tag (open, close or empty).

        Warning: the passed tag instance should not be kept beyond this method as the parser reuse it!

        Specified by:
        tag in interface TagVisitor
        Overrides:
        tag in class TagAdapter
      • text

        public void text​(java.lang.CharSequence text)
        Cleans unnecessary whitespaces.
        Specified by:
        text in interface TagVisitor
        Overrides:
        text in class TagAdapter
      • getStrippedCharsCount

        public int getStrippedCharsCount()
        Returns total number of stripped chars.