Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class Main {
    /**
     * This method creates an attribute with the given name and value.
     *
     * @param  sName    The name of the attribute.
     * @param  sValue   The value of the atrtibute.
     * @param  nParent  The parent node.
     */
    public static void createAttribute(String sName, String sValue, Node nParent) {
        if ((nParent != null) && (nParent instanceof Element)) {
            Element eParent = (Element) nParent;
            eParent.setAttribute(sName, sValue);
        }
    }
}