create Element and set tag name - Java XML

Java examples for XML:DOM Element Create

Description

create Element and set tag name

Demo Code


//package com.java2s;

import org.w3c.dom.Element;

public class Main {
    static public Element createElement(Element parent, String tagName) {
        Element tag = parent.getOwnerDocument().createElement(tagName);
        parent.appendChild(tag);//from  ww  w  . j  a  v  a 2 s . c o m
        return tag;
    }
}

Related Tutorials