code: public static String getAttribute(XMLStreamReader reader, String localName) {
          int count = reader.getAttributeCount();
          for (int i = 0; i < count; i++) {
              String name = reader.getAttributeLocalName(i);
              if (localName.equals(name)) {
                  return reader.getAttributeValue(i);
              }
          }
          return null;
      }
docs: Get the element attribute value
  
  @param reader
  @param localName
  @return