Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import org.w3c.dom.Attr;

import org.w3c.dom.Node;

public class Main {
    /**
     * Sets an attribute on the specified node, with the given name and value
     */
    public static void setDblValue(Node node, String name, double value) {
        setStrValue(node, name, Double.toString(value));
    }

    /**
     * Sets an attribute on the specified node, with the given name and value
     */
    public static void setStrValue(Node node, String name, String value) {
        Attr att = node.getOwnerDocument().createAttribute(name);
        node.getAttributes().setNamedItem(att);
        att.setValue(value);
    }
}