Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.Document;

import org.w3c.dom.Node;

public class Main {
    /**
     * Adds the attribute to the given node
     * @param doc
     * @param node
     * @param attrName
     * @param attrValue
     */
    public static void addAttr(Document doc, Node node, String attrName, Object attrValue) {
        Node attr = doc.createAttribute(attrName);
        attr.setNodeValue(attrValue.toString());
        node.getAttributes().setNamedItem(attr);
    }
}