Class TagBalancingHtmlStreamEventReceiver

  • All Implemented Interfaces:
    HtmlStreamEventReceiver

    public class TagBalancingHtmlStreamEventReceiver
    extends Object
    implements HtmlStreamEventReceiver
    Wraps an HTML stream event receiver to fill in missing close tags. If the balancer is given the HTML <p>1<p>2, the wrapped receiver will see events equivalent to <p>1</p><p>2</p>.
    Author:
    Mike Samuel ([email protected])
    • Constructor Detail

      • TagBalancingHtmlStreamEventReceiver

        public TagBalancingHtmlStreamEventReceiver​(HtmlStreamEventReceiver underlying)
        Parameters:
        underlying - An event receiver that should receive a stream of balanced events that is as close as possible to the stream of events received by this.
    • Method Detail

      • setNestingLimit

        public void setNestingLimit​(int limit)
        Set the maximum element nesting depth.
      • isInterElementWhitespace

        public static boolean isInterElementWhitespace​(String text)
        True if text is the value of an inter-element whitespace text node as defined by HTML5.

        This is the kind of text that is often inserted by HTML authors to nicely indent their HTML documents and which (modulo unconventional use of white-space:pre) are not apparent to the end-user.