EmptyString, parentNode, siblingIndex
Constructor and Description |
---|
TextNode(String text)
Create a new TextNode representing the supplied (unencoded) text).
|
TextNode(String text,
String baseUri)
Deprecated.
use
TextNode(String) |
Modifier and Type | Method and Description |
---|---|
static TextNode |
createFromEncoded(String encodedText)
Create a new TextNode from HTML encoded (aka escaped) data.
|
static TextNode |
createFromEncoded(String encodedText,
String baseUri)
Deprecated.
use
createFromEncoded(String) instead, as LeafNodes don't carry base URIs. |
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(StringBuilder sb) |
String |
nodeName()
Get the node name of this node.
|
(package private) static String |
normaliseWhitespace(String text) |
(package private) void |
outerHtmlHead(Appendable accum,
int depth,
Document.OutputSettings out)
Get the outer HTML of this node.
|
(package private) void |
outerHtmlTail(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 String |
stripLeadingWhitespace(String text) |
String |
text()
Get the text content of this text node.
|
TextNode |
text(String text)
Set the text content of this text node.
|
String |
toString() |
absUrl, attr, attr, attributes, baseUri, childNodeSize, coreValue, coreValue, doSetBaseUri, ensureChildNodes, hasAttr, hasAttributes, removeAttr
addChildren, addChildren, after, after, before, before, childNode, childNodes, childNodesAsArray, childNodesCopy, clearAttributes, clone, doClone, equals, filter, getOutputSettings, hasParent, hasSameValue, html, indent, nextSibling, nodelistChanged, outerHtml, outerHtml, ownerDocument, parent, parentNode, previousSibling, remove, removeChild, reparentChild, replaceChild, replaceWith, root, setBaseUri, setParentNode, setSiblingIndex, siblingIndex, siblingNodes, traverse, unwrap, wrap
public TextNode(String text)
text
- raw textcreateFromEncoded(String)
public TextNode(String text, String baseUri)
TextNode(String)
text
- raw textbaseUri
- base uri - ignored for this node typecreateFromEncoded(String, String)
public String nodeName()
Node
public String text()
getWholeText()
public TextNode text(String text)
text
- unencoded textpublic String getWholeText()
public boolean isBlank()
public TextNode splitText(int offset)
offset
- string offset point to split node at.void outerHtmlHead(Appendable accum, int depth, Document.OutputSettings out) throws IOException
Node
outerHtmlHead
in class Node
accum
- accumulator to place HTML intoIOException
- if appending to the given accumulator fails.void outerHtmlTail(Appendable accum, int depth, Document.OutputSettings out)
outerHtmlTail
in class Node
public static TextNode createFromEncoded(String encodedText, String baseUri)
createFromEncoded(String)
instead, as LeafNodes don't carry base URIs.encodedText
- Text containing encoded HTML (e.g. <)baseUri
- Base uripublic static TextNode createFromEncoded(String encodedText)
encodedText
- Text containing encoded HTML (e.g. <)static String normaliseWhitespace(String text)
static String stripLeadingWhitespace(String text)
static boolean lastCharIsWhitespace(StringBuilder sb)
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses