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 parent, String tagName) {
        Document doc = parent.getOwnerDocument();
        Element child = doc.createElement(tagName);
        parent.appendChild(child);
        return child;
    }

    public static void createElement(Element parent, String elementName, String text) {
        Document doc = parent.getOwnerDocument();
        Element id = doc.createElement(elementName);
        id.setTextContent(text);
        parent.appendChild(id);
    }
}