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 Summary
Fields Modifier and Type Field Description protected String
baseUri
protected org.jsoup.parser.Token
currentToken
protected Document
doc
static int
MaxScopeSearchDepth
protected Parser
parser
protected ParseSettings
settings
protected ArrayList<Element>
stack
-
Constructor Summary
Constructors Constructor Description HtmlTreeBuilder()
-
Method Summary
Modifier and Type Method Description protected Element
currentElement()
Get the current element (last on the stack).protected boolean
currentElementIs(String normalName)
Checks if the Current Element's normal name equals the supplied name.protected void
error(String msg)
If the parser is tracking errors, add an error at the current position.protected void
initialiseParse(Reader input, String baseUri, Parser parser)
protected boolean
isContentForTagData(String normalName)
(An internal method, visible for Element.protected boolean
process(org.jsoup.parser.Token token)
protected boolean
processEndTag(String name)
protected boolean
processStartTag(String name)
boolean
processStartTag(String name, Attributes attrs)
protected void
runParser()
String
toString()
-
Field Details
-
MaxScopeSearchDepth
public static final int MaxScopeSearchDepth- See Also:
- Constant Field Values
-
parser
-
doc
-
stack
-
baseUri
-
currentToken
protected org.jsoup.parser.Token currentToken -
settings
-
-
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
-
isContentForTagData
(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
-
processStartTag
-
processEndTag
-
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
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
If the parser is tracking errors, add an error at the current position.- Parameters:
msg
- error message
-