Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
Class Comment
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Comment
XML Comment 节点的表示形式。
详细文档
getParentElement()
获取节点的父 Element 节点。如果节点没有父级,此方法会返回 null。
返回
Element|null - 父级 Element 节点。
getText()
获取 Comment 节点的文本值。
返回
String - Comment 节点的文本值。
getValue()
按节点在文档中出现的顺序获取该节点的所有直属或非直属子节点的文本值。
返回
String - 相应节点的所有直接或间接子节点的文本值。
setText(text)
设置 Comment 节点的文本值。
参数
| 名称 | 类型 | 说明 |
text | String | 要设置的文本值。 |
返回
Comment - Comment 节点,用于链式调用。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2026-04-13。
[null,null,["最后更新时间 (UTC):2026-04-13。"],[],["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"]]