code: private static String getAttribute(String name, Element firstElement, Element secondElement) {
          String val = firstElement.getAttribute(name);
          if (val.length() == 0 && secondElement != null) {
              val = secondElement.getAttribute(name);
          }
          return val;
      }
docs: Try to get an attribute value from two elements.
  
  @param firstElement
  @param secondElement
  @return attribute value