Utils.java Source code

Java tutorial

Introduction

Here is the source code for Utils.java

Source

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

public class Utils {
    /**
     * Add a new element to the given parent
     * @param parent the parent Element
     * @param name the child name
     * @return new Element
     */
    public static Element createElement(Element parent, String name) {
        Document document;
        Element element;

        document = parent.getOwnerDocument();
        element = document.createElement(name);

        parent.appendChild(element);
        return element;
    }
}