public class XmlTreeBuilder extends Object
XmlTreeBuilder when you want to parse XML without any of the HTML DOM rules being applied to the
document.
Usage example: Document xmlDoc = Jsoup.parse(html, baseUrl, Parser.xmlParser());
| Modifier and Type | Field and Description |
|---|---|
protected String |
baseUri |
protected org.jsoup.parser.Token |
currentToken |
protected Document |
doc |
protected Parser |
parser |
protected Map<String,Tag> |
seenTags |
protected ParseSettings |
settings |
protected ArrayList<Element> |
stack |
| Constructor and Description |
|---|
XmlTreeBuilder() |
| Modifier and Type | Method and 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 |
error(String msg,
Object... args)
If the parser is tracking errors, add an error at the current position.
|
protected void |
initialiseParse(Reader input,
String baseUri,
Parser parser) |
protected void |
insertNode(Node node) |
protected void |
insertNode(Node node,
org.jsoup.parser.Token token) |
protected boolean |
isContentForTagData(String normalName)
(An internal method, visible for Element.
|
protected void |
onNodeClosed(Node node,
org.jsoup.parser.Token token)
Called by implementing TreeBuilders when a node is explicitly closed.
|
protected void |
onNodeInserted(Node node,
org.jsoup.parser.Token token)
Called by implementing TreeBuilders when a node has been inserted.
|
protected void |
popStackToClose(org.jsoup.parser.Token.EndTag endTag)
If the stack contains an element with this tag's name, pop up the stack to remove the first occurrence.
|
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() |
protected Tag |
tagFor(String tagName,
ParseSettings settings) |
protected Parser parser
protected Document doc
protected String baseUri
protected org.jsoup.parser.Token currentToken
protected ParseSettings settings
@ParametersAreNonnullByDefault protected void initialiseParse(Reader input, String baseUri, Parser parser)
protected boolean process(org.jsoup.parser.Token token)
protected void insertNode(Node node)
protected void insertNode(Node node, org.jsoup.parser.Token token)
protected void popStackToClose(org.jsoup.parser.Token.EndTag endTag)
endTag - tag to closeprotected void runParser()
protected boolean processStartTag(String name)
public boolean processStartTag(String name, Attributes attrs)
protected boolean processEndTag(String name)
protected Element currentElement()
protected boolean currentElementIs(String normalName)
normalName - name to checkprotected void error(String msg)
msg - error messageprotected void error(String msg, Object... args)
msg - error message templateargs - template argumentsprotected boolean isContentForTagData(String normalName)
protected Tag tagFor(String tagName, ParseSettings settings)
protected void onNodeInserted(Node node, @Nullable org.jsoup.parser.Token token)
node - the node that was just insertedtoken - the (optional) token that created this nodeprotected void onNodeClosed(Node node, org.jsoup.parser.Token token)
node - the node being closedtoken - the end-tag token that closed this nodeCopyright © 2009–2022 Jonathan Hedley. All rights reserved.