Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/* Copyright 2004 - 2007 Kasper Nielsen <kasper@codehaus.org> Licensed under
 * the Apache 2.0 License, see http://coconut.codehaus.org/license.
 */

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

public class Main {
    public static void contentIntSet(Document doc, Element base, String name, int value, int defaultInt) {
        if (value != defaultInt) {
            addElementAndSetContent(doc, name, base, Integer.toString(value));
        }
    }

    public static Element addElementAndSetContent(Document doc, String name, Element parent, String text) {
        Element ee = addElement(doc, name, parent);
        ee.setTextContent(text);
        return ee;
    }

    public static Element addElement(Document doc, String name, Element parent) {
        Element ee = doc.createElement(name);
        parent.appendChild(ee);
        return ee;
    }
}