Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {
    public static Element createElement(Element element, String tagName) {
        return createElement(element, tagName, null);
    }

    public static Element createElement(Element element, String tagName, String text) {
        Document doc = element.getOwnerDocument();
        Element child = doc.createElement(tagName);
        if (text != null)
            child.setTextContent(text);
        element.appendChild(child);
        return child;
    }
}