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 {
    /**
     * Creates an {@link Element} containing the given text
     * 
     * @param document the document to contain the new element
     * @param tagName the element's tag name (required)
     * @param text the text to set; can be <code>null</code> for none
     * @return a non-<code>null</code> element
     * @since 1.2.0
     */
    public static Element createTextElement(final Document document, final String tagName, final String text) {
        final Element element = document.createElement(tagName);
        element.setTextContent(text);
        return element;
    }
}