Class StripHtmlTagAdapter

java.lang.Object
jodd.lagarto.TagAdapter
jodd.lagarto.adapter.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 Details

    • strippedCharsCount

      protected int strippedCharsCount
    • strip

      protected boolean strip
    • PRE

      private static final CharSequence PRE
  • Constructor Details

    • StripHtmlTagAdapter

      public StripHtmlTagAdapter(TagVisitor target)
  • Method Details

    • 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(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(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.