EmptyNodes, EmptyString, parentNode, siblingIndex
Constructor and Description |
---|
TextNode(java.lang.String text)
Create a new TextNode representing the supplied (unencoded) text).
|
Modifier and Type | Method and Description |
---|---|
TextNode |
clone()
Create a stand-alone, deep copy of this node, and all of its children.
|
static TextNode |
createFromEncoded(java.lang.String encodedText)
Create a new TextNode from HTML encoded (aka escaped) data.
|
java.lang.String |
getWholeText()
Get the (unencoded) text of this text node, including any newlines and spaces present in the original.
|
boolean |
isBlank()
Test if this text node is blank -- that is, empty or only whitespace (including newlines).
|
(package private) static boolean |
lastCharIsWhitespace(java.lang.StringBuilder sb) |
java.lang.String |
nodeName()
Get the node name of this node.
|
(package private) static java.lang.String |
normaliseWhitespace(java.lang.String text) |
(package private) void |
outerHtmlHead(java.lang.Appendable accum,
int depth,
Document.OutputSettings out)
Get the outer HTML of this node.
|
(package private) void |
outerHtmlTail(java.lang.Appendable accum,
int depth,
Document.OutputSettings out) |
TextNode |
splitText(int offset)
Split this text node into two nodes at the specified string offset.
|
(package private) static java.lang.String |
stripLeadingWhitespace(java.lang.String text) |
java.lang.String |
text()
Get the text content of this text node.
|
TextNode |
text(java.lang.String text)
Set the text content of this text node.
|
java.lang.String |
toString()
Gets this node's outer HTML.
|
absUrl, attr, attr, attributes, baseUri, childNodeSize, coreValue, coreValue, doClone, doSetBaseUri, empty, ensureChildNodes, hasAttr, hasAttributes, removeAttr
addChildren, addChildren, after, after, attributesSize, before, before, childNode, childNodes, childNodesAsArray, childNodesCopy, clearAttributes, equals, filter, firstChild, forEachNode, forEachNode, hashCode, hasParent, hasSameValue, html, indent, isEffectivelyFirst, isNode, isNode, lastChild, nextSibling, nodelistChanged, normalName, outerHtml, outerHtml, ownerDocument, parent, parentNode, previousSibling, remove, removeChild, reparentChild, replaceChild, replaceWith, root, setBaseUri, setParentNode, setSiblingIndex, shallowClone, siblingIndex, siblingNodes, sourceRange, traverse, unwrap, wrap
public TextNode(java.lang.String text)
text
- raw textcreateFromEncoded(String)
public java.lang.String nodeName()
Node
public java.lang.String text()
getWholeText()
public TextNode text(java.lang.String text)
text
- unencoded textpublic java.lang.String getWholeText()
public boolean isBlank()
public TextNode splitText(int offset)
offset
- string offset point to split node at.void outerHtmlHead(java.lang.Appendable accum, int depth, Document.OutputSettings out) throws java.io.IOException
Node
outerHtmlHead
in class Node
accum
- accumulator to place HTML intojava.io.IOException
- if appending to the given accumulator fails.void outerHtmlTail(java.lang.Appendable accum, int depth, Document.OutputSettings out) throws java.io.IOException
outerHtmlTail
in class Node
java.io.IOException
public java.lang.String toString()
Node
toString
in class Node
Node.outerHtml()
public TextNode clone()
Node
The cloned node may be adopted into another Document or node structure using Element.appendChild(Node)
.
clone
in class Node
Node.shallowClone()
public static TextNode createFromEncoded(java.lang.String encodedText)
encodedText
- Text containing encoded HTML (e.g. <
)<
)static java.lang.String normaliseWhitespace(java.lang.String text)
static java.lang.String stripLeadingWhitespace(java.lang.String text)
static boolean lastCharIsWhitespace(java.lang.StringBuilder sb)