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 getAttribute(Node node, String name) {
        NamedNodeMap namedNodeMap = node.getAttributes();
        if (namedNodeMap == null) {
            return null;
        }
        Node attrNode = namedNodeMap.getNamedItem(name);
        if (attrNode == null) {
            return null;
        }
        return attrNode.getNodeValue();
    }
}