code: public static <T> T fromXml(File xmlPath, Class<T> type) {
          BufferedReader reader = null;
          StringBuilder sb = null;
          try {
              reader = new BufferedReader(new InputStreamReader(new FileInputStream(xmlPath), ENCODING));
              String line = null;
              sb = new StringBuilder();
              while ((line = reader.readLine()) != null) {
                  sb.append(line + "\n");
              }
          } catch (FileNotFoundException e) {
              throw new IllegalArgumentException(e.getMessage());
          } catch (Exception e) {
              throw new RuntimeException(e);
          } finally {
              if (reader != null) {
                  try {
                      reader.close();
                  } catch (IOException e) {
                      //ignore
                  }
              }
          }
          return fromXml(sb.toString(), type);
      }
docs: 从xml文件构建
  
  @param xmlPath
  @param type
  @param <T>
  @return