การนําเสนอโหนด 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 | แยกโหนดออกจากโหนด Element หลัก | 
get | Element | รับโหนด Element หลักของโหนด | 
get | String | รับค่าข้อความของโหนด Text | 
get | String | รับค่าข้อความของโหนดทั้งหมดที่เป็นโหนดย่อยโดยตรงหรือโดยอ้อมของโหนดนั้นๆ ตามลำดับที่ปรากฏในเอกสาร | 
set | Text | กำหนดค่าข้อความของโหนด Text | 
เอกสารประกอบโดยละเอียด
append(text)
ต่อท้ายข้อความที่ระบุไปยังเนื้อหาที่มีอยู่ในโหนดอยู่แล้ว
พารามิเตอร์
| ชื่อ | ประเภท | คำอธิบาย | 
|---|---|---|
text | String | ข้อความที่จะต่อท้ายโหนด | 
รีเทิร์น
Text — โหนด Text สำหรับเชน
detach()
get Parent Element()
get Text()
รับค่าข้อความของโหนด Text
รีเทิร์น
String — ค่าข้อความของโหนด Text
get Value()
รับค่าข้อความของโหนดทั้งหมดที่เป็นโหนดย่อยโดยตรงหรือโดยอ้อมของโหนดนั้นๆ ตามลำดับที่ปรากฏในเอกสาร
รีเทิร์น
String — ค่าข้อความของโหนดทั้งหมดที่เป็นโหนดย่อยโดยตรงหรือโดยอ้อมของโหนด
set Text(text)
กำหนดค่าข้อความของโหนด Text
พารามิเตอร์
| ชื่อ | ประเภท | คำอธิบาย | 
|---|---|---|
text | String | ค่าข้อความที่จะตั้งค่า | 
รีเทิร์น
Text — โหนด Text สำหรับเชน