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 {
    public static String requiredAttribute(String attributeName, Element node) {
        String attribute = node.getAttribute(attributeName);
        if (attribute == null || attribute.trim().isEmpty()) {
            throw new IllegalStateException(
                    String.format("Required attribute by name '%s' is null or empty", attributeName));
        }
        return attribute;
    }
}