Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.*;

public class Main {
    public static void setText(Element element, String Text) {
        Node node;
        node = element.getFirstChild();
        while (null != node) {
            if (Node.TEXT_NODE == node.getNodeType()) {
                Text text = (Text) node;
                text.setData(Text);
                return;
            }
        }
        Text text = element.getOwnerDocument().createTextNode(Text);
        element.appendChild(text);
    }
}