Java Utililty Methods XML Attribute Get

List of utility methods to do XML Attribute Get

Description

The list of methods to do XML Attribute Get are organized into topic(s).

Method

StringgetAttributeValue(Element el, String attributeName)
Gets the attribute value.
return (null == el ? null : el.getAttribute(attributeName));
StringgetAttributeValue(Element el, String attributeName)
get Attribute Value
return (null == el ? null : el.getAttribute(attributeName));
StringgetAttributeValue(Element el, String attrName)
Get the value from the given attribute
return getAttributeValue(el, new QName(attrName));
StringgetAttributeValue(Element ele, String attrName)
Helper function for quickly retrieving an attribute from a given element.
return decode(ele.getAttribute(attrName));
StringgetAttributeValue(Element elem, String name)
Returns the attribute value for the attribute with the specified name.
Attr attr = elem.getAttributeNodeNS(null, name);
return (attr == null) ? null : attr.getValue();
StringgetAttributeValue(Element element, String attr)
Return the attribute value.
return element.getAttributeNode(attr).getValue();
StringgetAttributeValue(Element element, String attributeName)
Returns the value of an attribute of a given XML element
return (null == element ? null : element.getAttribute(attributeName));
StringgetAttributeValue(Element element, String attributeName, String namespaceURI)
Get attribute value, returning null if unset.
String attributeValue;
if (namespaceURI == null) {
    attributeValue = element.getAttribute(attributeName);
} else {
    attributeValue = element.getAttributeNS(namespaceURI, attributeName);
if (attributeValue.length() == 0 && !element.hasAttribute(attributeName)) {
    return null;
...
StringgetAttributeValue(Element element, String attrName)
Get attribute value with the given name defined for the specified element.
String attrValue = null;
Attr attr = null;
if ((attr = element.getAttributeNode(attrName)) != null) {
    attrValue = attr.getValue().trim();
return attrValue;
StringgetAttributeValue(Element element, String attrName)
TODO: Case sensitive?
NamedNodeMap attributes = element.getAttributes();
Node attribute = attributes.getNamedItem(attrName);
if (attribute == null) {
    return null;
} else {
    return attribute.getNodeValue();