Java XML Attribute Set attributeStringValue(Element e, String attr, String defaultValue)

Here you can find the source of attributeStringValue(Element e, String attr, String defaultValue)

Description

attribute String Value

License

Open Source License

Declaration

public static String attributeStringValue(Element e, String attr, String defaultValue) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import org.w3c.dom.Element;

public class Main {
    public static String attributeStringValue(Element e, String attr, String defaultValue) {
        if (!e.hasAttribute(attr)) {
            return defaultValue;
        }/*w  w  w  . jav a2  s .  co m*/
        return e.getAttribute(attr);
    }
}

Related

  1. attributeOrValue(Element element, String mainAttribute, String... alternateAttributes)
  2. attributes(final Element element)
  3. attributesAsMap(Element element)
  4. attributesOf(Element element)
  5. attributeString(Node node, String attributeName)
  6. setAttribute(Element aElement, String aAttributeName, String aValue)
  7. setAttribute(Element elem, String name, String value)
  8. setAttribute(Element element, String attribute, String attributeValue, String attributeDefaultValue)
  9. setAttribute(Element element, String attributeName, String attributeValue)