Class Text
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
详细文档
append(text)
将指定文本附加到节点中已有的任何内容。
参数
| 名称 | 类型 | 说明 |
text | String | 要附加到节点的文本。 |
返回
Text - Text 节点,用于链式调用。
getParentElement()
获取节点的父 Element 节点。如果节点没有父级,此方法会返回 null。
返回
Element|null - 父级 Element 节点。
getText()
获取 Text 节点的文本值。
返回
String - Text 节点的文本值。
getValue()
按节点在文档中出现的顺序获取该节点的所有直属或非直属子节点的文本值。
返回
String - 相应节点的所有直接或间接子节点的文本值。
setText(text)
设置 Text 节点的文本值。
参数
| 名称 | 类型 | 说明 |
text | String | 要设置的文本值。 |
返回
Text - Text 节点,用于链式调用。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2026-02-11。
[null,null,["最后更新时间 (UTC):2026-02-11。"],[],["The `Text` node represents XML text content. Key actions include: appending text to the node via `append(text)`, detaching the node from its parent using `detach()`, and retrieving the parent element with `getParentElement()`. Text content can be obtained using `getText()` for the node's text or `getValue()` for text of child nodes. Finally, `setText(text)` sets the text value of the node. These methods allow manipulation and reading of text in an XML structure.\n"]]