'How to insert an image in javascript when calling XML data?

I have data in an XML and I want to display it in a table in my HTML page. I can display my values, and I can even display the url of my image. I thought, I just need to add the <img> tag, but when I add the latter, I can't see anything.

function myFunction(xml) {
  var i;
  var xmlDoc = xml.responseXML;
  var table="<tr><th>Transporter</th><th>Type</th><th>Logo</th></tr>";
  var x = xmlDoc.getElementsByTagName("data");
  for (i = 0; i <x.length; i++) {
    table += "<tr><td>" +
    x[i].getElementsByTagName("transporter")[0].childNodes[0].nodeValue +
    "</td><td>" +
    x[i].getElementsByTagName("type")[0].childNodes[0].nodeValue +
    "</td><td>" + "<img src=\""
    x[i].getElementsByTagName("logo")[0].childNodes[0].nodeValue +
    "\"> </td></tr>";
  }
  document.getElementById("transporterlist").innerHTML = table;
} 

Do you think this is not possible? Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source