private void xmlImportUser(List<Element> user)
      throws ImportDocumentException, PasswordIsTooWeakException {
    for (Element node : user) {
      String username = node.getAttributeValue("username");
      User toInsert;

      try {
        this.getUserByUsername(username);
      } catch (UserAlreadyExistsException e) {
        e.getMessage();
        throw new ImportDocumentException();
      } catch (UserUnknownException e) {
        toInsert = new User(username, this);

        if (node.getChild("password") != null)
          toInsert.setPassword(node.getChild("password").getValue());

        if (node.getChild("name") != null) toInsert.setName(node.getChild("name").getValue());

        if (node.getChild("mask") != null) toInsert.setUmask(node.getChild("mask").getValue());

        if (node.getChild("home") != null) {
          String[] tokens = node.getChild("home").getValue().split(PATH_DELIM);
          toInsert.setHomeDirectory(
              createDir(
                  createPath(node.getChild("home").getValue()),
                  tokens[tokens.length - 1],
                  toInsert));
        } else {
          Directory homeDirectory =
              new Directory(
                  this.generateUniqueId(),
                  username,
                  toInsert.getUmask(),
                  toInsert,
                  getHomeDirectory());
          toInsert.setHomeDirectory(homeDirectory);
          this.addDirectoryToHome(homeDirectory);
        }
        super.addUsers(toInsert);
      }
    }
  }
  /**
   * Create a new user when you first open up the app.
   *
   * <p>If the username or email fields are empty, prompt the user with a toast warning. If both
   * fields are entered, take the fields and assign them to string variables. Put these string
   * variables into the database by calling the DatabaseController method to create a new user.
   *
   * <p>However this also has another core functionality. If the user is already there then we give
   * the user a welcome message and forward them to the next activity.
   *
   * @param view View Object.
   */
  public void newUser(View view) {
    final Context context = getApplicationContext();
    final String username;
    User new_guy = null;

    if (newUserName.getText().toString().isEmpty()
        || newUserName.getText().toString().equals(" ")) {
      Toast.makeText(context, "You need a name!", Toast.LENGTH_SHORT).show();
    } else if (newUserEmail.getText().toString().isEmpty()
        || newUserEmail.getText().toString().equals(" ")) {
      Toast.makeText(context, "You need an email!", Toast.LENGTH_SHORT).show();
    } else {
      username = newUserName.getText().toString();

      // Used for error checking
      // If null, then it failed
      try {
        new_guy = DatabaseController.createNewUser(username, newUserEmail.getText().toString());
      } catch (UserAlreadyExistsException e) {
        e.printStackTrace();
      } catch (NoInternetException ex) {
        Toast.makeText(
                context, "Need to be online to create an account!" + username, Toast.LENGTH_SHORT)
            .show();
        return;
      }

      if (new_guy != null) {
        Toast.makeText(context, "Welcome, " + username, Toast.LENGTH_SHORT).show();
        setContentView(R.layout.activity_main);

        recentActivities = (ListView) findViewById(R.id.activitiesList);
        notifications = new ArrayList<Notification>();
        adapter = new RecentActivityAdapter(this, notifications);

        recentActivities.setAdapter(adapter);
      } else {
        Toast.makeText(context, username + " Already Exists!", Toast.LENGTH_SHORT).show();
        // Do nothing
      }
    }
  }