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 {
    /**
     * Queries the value of an attribute of a given xml node
     *
     * @param n xml node
     * @param attribute name of the attribute
     * @return assigned value for the attribute in that node
     */
    public static String getAttributeValue(Node n, String attribute) {
        return n.getAttributes().getNamedItem(attribute).getNodeValue();
    }
}