code: public static View createViewFromXML(String name, InputStream xml) throws IOException {
  
          try (InputStream in = new BufferedInputStream(xml)) {
              View v = (View) Jenkins.XSTREAM.fromXML(in);
              if (name != null) v.name = name;
              Jenkins.checkGoodName(v.name);
              return v;
          } catch(StreamException|ConversionException|Error e) {// mostly reflection errors
              throw new IOException("Unable to read",e);
          }
      }
docs: Instantiate View subtype from XML stream.
  
  @param name Alternative name to use or {@code null} to keep the one in xml.