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;
import org.w3c.dom.Text;

public class Main {
    public static void appendTextChild(Element parent, String tagname, String text) {
        if (text == null) {
            text = "";
        }
        Document doc = parent.getOwnerDocument();
        Element childElement = doc.createElement(tagname);
        Text textNode = doc.createTextNode(text);
        childElement.appendChild(textNode);
        parent.appendChild(childElement);
    }
}