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 節點,用於鏈結。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2026-02-11 (世界標準時間)。
[null,null,["上次更新時間: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"]]