Package org.jsoup.parser

Class HtmlTreeBuilder

java.lang.Object
org.jsoup.parser.HtmlTreeBuilder

public class HtmlTreeBuilder
extends Object
HTML Tree Builder; creates a DOM from Tokens.
  • Field Details

  • Constructor Details

    • HtmlTreeBuilder

      public HtmlTreeBuilder()
  • Method Details

    • initialiseParse

      @ParametersAreNonnullByDefault protected void initialiseParse​(Reader input, String baseUri, Parser parser)
    • process

      protected boolean process​(org.jsoup.parser.Token token)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isContentForTagData

      protected boolean isContentForTagData​(String normalName)
      (An internal method, visible for Element. For HTML parse, signals that script and style text should be treated as Data Nodes).
    • runParser

      protected void runParser()
    • processStartTag

      protected boolean processStartTag​(String name)
    • processStartTag

      public boolean processStartTag​(String name, Attributes attrs)
    • processEndTag

      protected boolean processEndTag​(String name)
    • currentElement

      protected Element currentElement()
      Get the current element (last on the stack). If all items have been removed, returns the document instead (which might not actually be on the stack; use stack.size() == 0 to test if required.
      Returns:
      the last element on the stack, if any; or the root document
    • currentElementIs

      protected boolean currentElementIs​(String normalName)
      Checks if the Current Element's normal name equals the supplied name.
      Parameters:
      normalName - name to check
      Returns:
      true if there is a current element on the stack, and its name equals the supplied
    • error

      protected void error​(String msg)
      If the parser is tracking errors, add an error at the current position.
      Parameters:
      msg - error message
    • error

      protected void error​(String msg, Object... args)
      If the parser is tracking errors, add an error at the current position.
      Parameters:
      msg - error message template
      args - template arguments
    • tagFor

      protected Tag tagFor​(String tagName, ParseSettings settings)