Create cdata Content Tag - Java XML

Java examples for XML:CDATA

Description

Create cdata Content Tag

Demo Code


//package com.java2s;

import org.w3c.dom.Element;

public class Main {
    public static void cdataContentTag(Element parent, String tagName,
            String cdata) {// w  w w.j a va2  s .  com
        Element tag = parent.getOwnerDocument().createElement(tagName);
        tag.appendChild(parent.getOwnerDocument().createCDATASection(cdata));
        parent.appendChild(tag);
    }

    static public Element createElement(Element parent, String tagName) {
        Element tag = parent.getOwnerDocument().createElement(tagName);
        parent.appendChild(tag);
        return tag;
    }
}

Related Tutorials