Fill an XML file with test data

I have an XML file looks like the attached image: XML file

The attributes (commitId, author, date, and time) in I got it from Git open source repository using “blame” command.

However, for my evaluation, I need to fill these attributes randomly with data I have. For example, I have Junio, Peter, Jiang, Jens, Jeff, Ramkumar, and Linus as authors, and date is ranged between 2010 and 2012.

what is the best way to fill this data using Java?

  • How does git rerere figure out the similarities between two conflicts?
  • How to handle xml/html in git feature branch workflow?
  • Horizontal Listview Not Working from github
  • Not showing branch name while fetching code using repo utility
  • Getting errors with ant in netbeans, but no meaningful error message is produced
  • How can I merge mysql workbench (*.mwb) diagram with git If I know how to make a text representation of it?
  • how to change columns order in jenkins open source project?
  • Automatically merge two XML files by selecting both conflicting lines
  • One Solution collect form web for “Fill an XML file with test data”

    You can start by placing the values you need into arrays like this:

       String names[] = {Junio, Peter, Jiang, Jens, Jeff, Ramkumar, Linus};
       String dates[] = {2010, 2011, 2012};

    Then using the Random class you can do this:

        Random ran = new Random();
        String name = names[ran.nextInt(7)];
        String date = dates[ran.nextInt(3)];

    That will give you a random name and date. Rinse. Repeat.

    Note that to get a random number between 0 and n inclusive you need nextInt(n + 1).

    Git Baby is a git and github fan, let's start git clone.