Java XML CDATA Append appendCDATASection(Node parent, String name, Object data)

Here you can find the source of appendCDATASection(Node parent, String name, Object data)

Description

append CDATA Section

License

Open Source License

Declaration

public static void appendCDATASection(Node parent, String name, Object data) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class Main {
    public static void appendCDATASection(Node parent, String name, Object data) {
        Document doc = (parent.getNodeType() == Node.DOCUMENT_NODE) ? (Document) parent : parent.getOwnerDocument();
        Element e = doc.createElement(name);
        parent.appendChild(e);//from www .  j a  v  a 2s .  co m
        e.appendChild(doc.createCDATASection(data.toString()));
    }
}

Related

  1. appendCDATA(Element parent, String content)
  2. appendCDATAElement(Element parent, String name, String content)
  3. appendCDATAElement(Element parent, String tagName, String value)
  4. appendCDATAElement(Element parent, String tagName, String value)
  5. appendCDATASection(CDATASection cdataSection, StringBuffer buf)
  6. appendCDATASubNode(String elementName, String nodeData, Element parentElement, Document doc)
  7. setCDATA(Element element, String data)
  8. setCData(Element element, String data)