• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.jsoup.nodes;
2 
3 import java.io.IOException;
4 
5 /**
6  * A Character Data node, to support CDATA sections.
7  */
8 public class CDataNode extends TextNode {
CDataNode(String text)9     public CDataNode(String text) {
10         super(text);
11     }
12 
13     @Override
nodeName()14     public String nodeName() {
15         return "#cdata";
16     }
17 
18     /**
19      * Get the unencoded, <b>non-normalized</b> text content of this CDataNode.
20      * @return unencoded, non-normalized text
21      */
22     @Override
text()23     public String text() {
24         return getWholeText();
25     }
26 
27     @Override
outerHtmlHead(Appendable accum, int depth, Document.OutputSettings out)28     void outerHtmlHead(Appendable accum, int depth, Document.OutputSettings out) throws IOException {
29         accum
30             .append("<![CDATA[")
31             .append(getWholeText());
32     }
33 
34     @Override
outerHtmlTail(Appendable accum, int depth, Document.OutputSettings out)35     void outerHtmlTail(Appendable accum, int depth, Document.OutputSettings out) throws IOException {
36         accum.append("]]>");
37     }
38 
39     @Override
clone()40     public CDataNode clone() {
41         return (CDataNode) super.clone();
42     }
43 }
44