code: private String getAttributeSmart(Element element, String attr)
     {
        return element.hasAttribute(attr) ? element.getAttribute(attr) : null;
     }
docs: Get attribute value.
  
  @param element The element to get attribute value
  @param attr The attribute name
  @return Value of attribute if present and null in other case