code: private static InputSource stringToSource(String str) {
          InputSource is = new InputSource(new StringReader(str));
          is.setEncoding("UTF-8");
          return is;
      }
docs: Convert a string to an InputSource object
  
  @param str string
  @return InputSource of input