Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.Node;

public class Main {
    /**
     * Gets the value from a node's attribute.
     * 
     * @param node
     *            the node.
     * @param attributeName
     *            the name of the attribute.
     * @return the value of the attribute with the specified name or
     *         <code>null</code> if there is no attribute with that name.
     */
    public static Node getAttributeValue(Node node, String attributeName) {
        return (node.hasAttributes()) ? node.getAttributes().getNamedItem(attributeName) : null;

    }
}