Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.Element;

public class Main {
    /**
     * @return true if the specified attribute is present and not empty or null in the element
     */
    public static boolean hasAttribute(Element element, String attribute) {
        String s = element.getAttribute(attribute);
        if (s == null || "".equals(s)) {
            return false;
        } else {
            return true;
        }
    }
}