Java tutorial
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Element; public class Main { public static String getAttribute(Element element, String attributeName) { return (element.hasAttribute(attributeName) ? element.getAttribute(attributeName) : null); } public static String getAttribute(Element element, String namespaceName, String attributeName) { return (element.hasAttributeNS(namespaceName, attributeName) ? element.getAttributeNS(namespaceName, attributeName) : null); } }