Search in sources :

Example 1 with CDataNode

use of org.jsoup.nodes.CDataNode in project jsoup by jhy.

the class HtmlTreeBuilder method insert.

void insert(Token.Character characterToken) {
    final Node node;
    // will be doc if no current element; allows for whitespace to be inserted into the doc root object (not on the stack)
    Element el = currentElement();
    final String tagName = el.normalName();
    final String data = characterToken.getData();
    if (characterToken.isCData())
        node = new CDataNode(data);
    else if (isContentForTagData(tagName))
        node = new DataNode(data);
    else
        node = new TextNode(data);
    // doesn't use insertNode, because we don't foster these; and will always have a stack.
    el.appendChild(node);
}
Also used : DataNode(org.jsoup.nodes.DataNode) CDataNode(org.jsoup.nodes.CDataNode) TextNode(org.jsoup.nodes.TextNode) Node(org.jsoup.nodes.Node) DataNode(org.jsoup.nodes.DataNode) CDataNode(org.jsoup.nodes.CDataNode) Element(org.jsoup.nodes.Element) FormElement(org.jsoup.nodes.FormElement) TextNode(org.jsoup.nodes.TextNode) CDataNode(org.jsoup.nodes.CDataNode)

Aggregations

CDataNode (org.jsoup.nodes.CDataNode)1 DataNode (org.jsoup.nodes.DataNode)1 Element (org.jsoup.nodes.Element)1 FormElement (org.jsoup.nodes.FormElement)1 Node (org.jsoup.nodes.Node)1 TextNode (org.jsoup.nodes.TextNode)1