XML CDATASection 节点的表示形式。
// Create and log an XML document that shows how special characters like '<', // '>', and '&' are stored in a CDATASection node as compared to in a Text node. const illegalCharacters = '<em>The Amazing Adventures of Kavalier & Clay</em>'; const cdata = XmlService.createCdata(illegalCharacters); const text = XmlService.createText(illegalCharacters); const root = XmlService.createElement('root').addContent(cdata).addContent(text); const document = XmlService.createDocument(root); const xml = XmlService.getPrettyFormat().format(document); Logger.log(xml);
方法
| 方法 | 返回类型 | 简介 |
|---|---|---|
append(text) | Text | 将指定文本附加到节点中已有的任何内容。 |
detach() | Content|null | 将节点从其父级 Element 节点分离。 |
get | Element|null | 获取节点的父 Element 节点。 |
get | String | 获取 Text 节点的文本值。 |
get | String | 按节点在文档中出现的顺序获取该节点的所有直属或非直属子节点的文本值。 |
set | Text | 设置 Text 节点的文本值。 |
详细文档
append(text)
get Text()
获取 Text 节点的文本值。
返回
String - Text 节点的文本值。
get Value()
按节点在文档中出现的顺序获取该节点的所有直属或非直属子节点的文本值。
返回
String - 相应节点的所有直接或间接子节点的文本值。