Class Comment
详细文档
getText()
获取 Comment
节点的文本值。
返回
String
- Comment
节点的文本值
getValue()
获取节点的直接或间接子节点的所有文本值,按文档中显示的顺序。
返回
String
- 节点的直接或间接子节点的所有文本值
setText(text)
设置 Comment
节点的文本值。
参数
返回
Comment
- Comment
节点,用于链式调用
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-12-03。
[null,null,["最后更新时间 (UTC):2024-12-03。"],[[["Represents an XML `Comment` node, providing methods for interaction."],["Allows detachment from parent element, retrieval of parent/text values, and text modification."],["Includes `getText()` for the comment's text and `getValue()` for text of all child nodes."],["Offers `setText()` to modify the comment's text and `detach()` to remove it from its parent."]]],["An XML `Comment` node can be manipulated using several methods. `detach()` removes the node from its parent element. `getParentElement()` retrieves the parent `Element` node, if any. `getText()` and `getValue()` return the text content of the `Comment` node and its children respectively. The `setText(text)` method updates the text content of the `Comment` node and supports method chaining by returning the updated `Comment` node.\n"]]