code: static <T extends Enum<T>> T getEnumFromString(Class<T> c, String string) throws
              XmlPullParserException {
          if (c != null && string != null) {
              try {
                  T t = Enum.valueOf(c, string.trim().toUpperCase());
                  return t;
              } catch (IllegalArgumentException e) {
                  throw new XmlPullParserException("Invalid value for " + c.getSimpleName());
              }
          } else {
              throw new XmlPullParserException("Null class or string");
          }
      }
docs: TODO see if convert to Enums in network library is better