Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.Node;

public class Main {
    /**
     * Creates and returns a new XML node with the specified name, as a child
     * of the given parent
     * Returns null if the child could not be created
     */
    public static Node createChild(Node parent, String name) {
        // Create the node
        Node child = parent.getOwnerDocument().createElement(name);
        if (child != null) {
            // Add it to the document
            parent.appendChild(child);
        }

        return child;
    }
}