Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public class Main {
    public static String getAttributeFromNode(Node node, String attributeName) {
        if (node == null || attributeName == null)
            return null;
        NamedNodeMap attributes = node.getAttributes();
        Node attribute = attributes.getNamedItem(attributeName);
        String value = null;
        if (attribute != null)
            value = attribute.getNodeValue();
        return value;
    }
}