AI-generated Key Takeaways
-
The
Text
object represents a text node within an XML document and provides methods for manipulating its content. -
You can use methods like
append()
,setText()
, andgetText()
to modify and retrieve the text content of the node. -
detach()
removes the node from its parent element, whilegetParentElement()
allows access to the parent element. -
getValue()
retrieves the text value of all child nodes, offering a way to access nested content within the text node.
A representation of an XML Text
node.
Methods
Method | Return type | Brief description |
---|---|---|
append(text) | Text | Appends the given text to any content that already exists in the node. |
detach() | Content | Detaches the node from its parent Element node. |
get | Element | Gets the node's parent Element node. |
get | String | Gets the text value of the Text node. |
get | String | Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document. |
set | Text | Sets the text value of the Text node. |
Detailed documentation
append(text)
Appends the given text to any content that already exists in the node.
Parameters
Name | Type | Description |
---|---|---|
text | String | the text to append to the node |
Return
Text
— the Text
node, for chaining
detach()
getParentElement()
getText()
Gets the text value of the Text
node.
Return
String
— the text value of the Text
node
getValue()
Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document.
Return
String
— the text value of all nodes that are direct or indirect children of the node
setText(text)
Sets the text value of the Text
node.
Parameters
Name | Type | Description |
---|---|---|
text | String | the text value to set |
Return
Text
— the Text
node, for chaining