Managed to pull the base64 string out of the XML file with js a function but how do i display it in the browser/src attribute?? Or is there a better way!
The xml file will change so the xml photo tag image string will change. It works if i paste the text string in but need the function to update the string... if that makes sense.
<p id="demo">
<script>
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myFunction(this);
}
};
xhttp.open("GET", "PhotoAsXML.xml", true);
xhttp.send();
function myFunction(xml) {
var xmlDoc = xml.responseXML;
document.getElementById("demo").innerHTML =
xmlDoc.getElementsByTagName("FullName")[0].childNodes[0].nodeValue + "<br>" +
xmlDoc.getElementsByTagName("Photo")[0].childNodes[0].nodeValue;
}
</script>
</p>
<img style='display:block; width:140px;height:180px;' id='base64image' src="data:image/png;base64," />