Example usage for org.w3c.dom Element getAttribute

List of usage examples for org.w3c.dom Element getAttribute

Introduction

In this page you can find the example usage for org.w3c.dom Element getAttribute.

Prototype

public String getAttribute(String name);

Source Link

Document

Retrieves an attribute value by name.

Usage

From source file:Main.java

public static boolean getBooleanAttribute(Element el, String attr) {
    return Boolean.parseBoolean(el.getAttribute(attr));
}

From source file:Main.java

public static String getAttributeValue(Element element, String attribute) {
    return element.getAttribute(attribute);
}

From source file:Main.java

public static String getElementStringValue(Element element, String attribute) {
    return element.getAttribute(attribute);
}

From source file:Main.java

static public String getTrimmedAttribute(Element element, String name) {
    return element.getAttribute(name).trim();
}

From source file:Main.java

public static String getAttribute(Element element, String attrName) {
    return element.getAttribute(attrName);
}

From source file:Main.java

/**
 * @param element/*w w w  .  ja  va  2  s  .  com*/
 * @param atrName
 * @return String attribute or nul if not defined or empty
 */
public static String getSingleNonEmptyStringAtributeFromElement(Element element, String atrName) {
    String atrValue = element.getAttribute(atrName);
    return atrValue.isEmpty() ? null : atrValue;
}

From source file:Main.java

public static String getAttribute(Element elem, String att) {
    String res = elem.getAttribute(att);
    return res.length() == 0 && !elem.hasAttribute(att) ? null : res;
}

From source file:Main.java

public static String getTagPropertyValueWithinEelement(Element ele, String tagName, String attr) {
    String desc = ele.getAttribute(attr);

    return desc;/*from   ww w.j av  a  2s .  co  m*/
}

From source file:Main.java

/**
 * @return true if the specified attribute is present and not empty or null in the element
 *//*from  ww w  . jav a2s . c  o  m*/
public static boolean hasAttribute(Element element, String attribute) {
    String s = element.getAttribute(attribute);
    if (s == null || "".equals(s)) {
        return false;
    } else {
        return true;
    }
}

From source file:Main.java

public static String getAttibute(Element parent, String AttibuteName) {
    final String value = parent.getAttribute(AttibuteName);
    return value;
}