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 {
    /**
     * Gets the attribute value.
     * @param pElement XML Element containing the attribute
     * @param pAttributeName Name of the attribute
     * @param pDefaultValue  Default value (may be null)
     * @return The attribute's value, or the default value is not such attribute is defined
     */
    static public String getAttribute(Element pElement, String pAttributeName, String pDefaultValue) {
        final String value = pElement.getAttribute(pAttributeName);
        return (value != null ? value : pDefaultValue);
    }
}