表示 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. var illegalCharacters = '<em>The Amazing Adventures of Kavalier & Clay</em>'; var cdata = XmlService.createCdata(illegalCharacters); var text = XmlService.createText(illegalCharacters); var root = XmlService.createElement('root').addContent(cdata).addContent(text); var document = XmlService.createDocument(root); var xml = XmlService.getPrettyFormat().format(document); Logger.log(xml);
方法
方法 | 返回类型 | 简介 |
---|---|---|
append(text) | Text | 将指定文本附加到节点中已存在的任何内容。 |
detach() | Content | 将节点与其父 Element 节点分离。 |
getParentElement() | Element | 获取节点的父级 Element 节点。 |
getText() | String | 获取 Text 节点的文本值。 |
getValue() | String | 按照节点在文档中出现的顺序获取作为节点的直接或间接子节点的所有节点的文本值。 |
setText(text) | Text | 设置 Text 节点的文本值。 |
详细文档
append(text)
getText()
获取 Text
节点的文本值。
弃踢回攻
String
- Text
节点的文本值
getValue()
按照节点在文档中出现的顺序获取作为节点的直接或间接子节点的所有节点的文本值。
弃踢回攻
String
- 所有是节点直接或间接子节点的文本值