Java XML Attribute Set attributeString(Node node, String attributeName)

Here you can find the source of attributeString(Node node, String attributeName)

Description

attribute String

License

Open Source License

Declaration

public static String attributeString(Node node, String attributeName) 

Method Source Code


//package com.java2s;
import org.w3c.dom.Node;

public class Main {
    public static String attributeString(Node node, String attributeName) {
        if (node.hasAttributes()) {
            Node attr = node.getAttributes().getNamedItem(attributeName);
            if (attr != null) {
                return attr.getNodeValue();
            }//from  w ww  .  ja  v  a  2 s  . com
        }

        return null;

    }
}

Related

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