java.lang.Object | ||
↳ | org.jsoup.nodes.Node | |
↳ | org.jsoup.nodes.TextNode |
A text node.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new TextNode representing the supplied (unencoded) text).
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Get an absolute URL from a URL attribute that may be relative (i.e.
| |||||||||||
Get an attribute's value by its key.
| |||||||||||
Set an attribute (key=value).
| |||||||||||
Get all of the element's attributes.
| |||||||||||
Create a new TextNode from HTML encoded (aka escaped) data.
| |||||||||||
Get the (unencoded) text of this text node, including any newlines and spaces present in the original.
| |||||||||||
Test if this element has an attribute.
| |||||||||||
Test if this text node is blank -- that is, empty or only whitespace (including newlines).
| |||||||||||
Get the node name of this node.
| |||||||||||
Remove an attribute from this element.
| |||||||||||
Split this text node into two nodes at the specified string offset.
| |||||||||||
Set the text content of this text node.
| |||||||||||
Get the text content of this text node.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.jsoup.nodes.Node
| |||||||||||
From class
java.lang.Object
|
Create a new TextNode representing the supplied (unencoded) text).
text | raw text |
---|---|
baseUri | base uri |
Get an absolute URL from a URL attribute that may be relative (i.e. an <a href>
or
<img src>
).
String absUrl = linkEl.absUrl("href");
If the attribute value is already absolute (i.e. it starts with a protocol, like
http://
or https://
etc), and it successfully parses as a URL, the attribute is
returned directly. Otherwise, it is treated as a URL relative to the element's baseUri()
, and made
absolute using that.
As an alternate, you can use the attr(String)
method with the abs:
prefix, e.g.:
String absUrl = linkEl.attr("abs:href");
attributeKey | The attribute key |
---|
Get an attribute's value by its key.
To get an absolute URL from an attribute that may be a relative URL, prefix the key withabs
,
which is a shortcut to the absUrl(String)
method.
E.g.: String url = a.attr("abs:href");
attributeKey | The attribute key. |
---|
Set an attribute (key=value). If the attribute already exists, it is replaced.
attributeKey | The attribute key. |
---|---|
attributeValue | The attribute value. |
Get all of the element's attributes.
Create a new TextNode from HTML encoded (aka escaped) data.
encodedText | Text containing encoded HTML (e.g. <) |
---|
Get the (unencoded) text of this text node, including any newlines and spaces present in the original.
Test if this element has an attribute.
attributeKey | The attribute key to check. |
---|
Test if this text node is blank -- that is, empty or only whitespace (including newlines).
Get the node name of this node. Use for debugging purposes and not logic switching (for that, use instanceof).
Remove an attribute from this element.
attributeKey | The attribute to remove. |
---|
Split this text node into two nodes at the specified string offset. After splitting, this node will contain the original text up to the offset, and will have a new text node sibling containing the text after the offset.
offset | string offset point to split node at. |
---|
Set the text content of this text node.
text | unencoded text |
---|