title: Replacing elements in an HTML file with JSON objects
body: <p>I am writing some Javascript to:</p>
  
  <ol>
  <li>Read in and Parse a JSON file</li>
  <li>Read in an HTML file (created as a template file)</li>
  <li>Replace elements in the HTML file with elements from the JSON file.</li>
  </ol>
  
  <p>It is only replacing the first element obj.verb. Can someone please help me figure out where I am getting the syntax or overall approach wrong? Please see the code below and a sample of what the JSON file looks like under that as well.</p>
  
  <pre><code>fs.readFile("./tasks/example.json",'utf8', function(err, jsonObjectForHIT){
  
  // parse json file and assign to variable obj
  var obj = JSON.parse(jsonObjectForHIT)
  
  // read in template file 
  fs.readFile("./tasks/StageOneQuestionTemplate1.html", function(err, addedXML){
  // replace value from template with value from json object and assign to variable finalXML
  var finalXML = String(addedXML).replace(/VerbGoesHere/g,obj.verb);
  var finalXML = String(addedXML).replace(/RoleOne/g,obj.roles[0]);
  var finalXML = String(addedXML).replace(/RoleTwo/g,obj.roles[1]);
  var finalXML = String(addedXML).replace("RoleThree",obj.roles[2])
  }
  </code></pre>
  
  <p><strong>Sample JSON file referenced above.</strong></p>
  
  <pre><code>{
  "verb":"tenir",
  "roles":[
              {"name":"with whom"},
              {"name":"thing held"},
              {"name":"conductor"}
          ],
  "srcLanguageSentence":{ "text":"Burmah said it had n't held any discussions with SHV and that `` no deal of any nature is in contemplation .",
                          "verb":{"text":"held","sense":"HOLD, conduct","beginOffset":24,"endOffset":28},
                          "roles":[
                                      {"name":"with whom","text":"with SHV","beginOffset":45,"endOffset":53},
                                      {"name":"thing held","text":"any discussions","beginOffset":29,"endOffset":44},
                                      {"name":"conductor","text":"it","beginOffset":13,"endOffset":15}
                                  ]
                         },
  "tgtLanguageSentences":[
                              { 
                                  "text":"Je tiens �galement � mentionner la r�cente Conf�rence , tenue au Canada , sur les enfants touch�s par la guerre .",
                                  "verb":{"text":"tenue","beginOffset":57,"endOffset":62},
                                  "roles":[
                                      {"name":"thing held","text":"la r�cente Conf�rence , , sur les enfants touch�s par la guerre","beginOffset":33,"endOffset":112},
                                      {"name":"location information","text":"au Canada","beginOffset":63,"endOffset":72}
                                  ]
                              }
                         ]
  </code></pre>
  
  <p>}</p>