code: protected boolean hasAttribute(List<Element> elements, String attributeName, boolean checkValue)
      {
          boolean hasAttribute = true;
          if (!checkValue) {
              for (Element e : elements) {
                  hasAttribute = e.hasAttribute(attributeName) ? hasAttribute : false;
              }
          } else {
              String attributeValue = null;
              for (Element e : elements) {
                  attributeValue = attributeValue == null ? e.getAttribute(attributeName) : attributeValue;
                  hasAttribute = e.getAttribute(attributeName).equals(attributeValue) ? hasAttribute : false;
              }
          }
          return hasAttribute;
      }
docs: Utility method for checking if a list of elements have the same attribute set. If the checkValue is true, the
  values of the given attribute will be checked for equivalency.
  
  @param elements the list of elements.
  @param attributeName Name of the attribute.
  @param checkValue flag indicating if the value of the attribute should be equal among all the elements.
  @return true if the given attribute is present and the value check is passing.