001package org.jsoup.nodes;
002
003import java.io.IOException;
004
005/**
006 * A Character Data node, to support CDATA sections.
007 */
008public class CDataNode extends TextNode {
009    public CDataNode(String text) {
010        super(text);
011    }
012
013    @Override
014    public String nodeName() {
015        return "#cdata";
016    }
017
018    /**
019     * Get the unencoded, <b>non-normalized</b> text content of this CDataNode.
020     * @return unencoded, non-normalized text
021     */
022    @Override
023    public String text() {
024        return getWholeText();
025    }
026
027    @Override
028    void outerHtmlHead(Appendable accum, int depth, Document.OutputSettings out) throws IOException {
029        accum
030            .append("<![CDATA[")
031            .append(getWholeText());
032    }
033
034    @Override
035    void outerHtmlTail(Appendable accum, int depth, Document.OutputSettings out) throws IOException {
036        accum.append("]]>");
037    }
038
039    @Override
040    public CDataNode clone() {
041        return (CDataNode) super.clone();
042    }
043}