<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vacantes Performia</title>
</head>
<body>
<table id="output" style="max-width: 800px; margin: auto;">

</table>
<script>
function decodeEntities(encodedString) {
const textArea = document.createElement('textarea');
textArea.innerHTML = encodedString;
return textArea.value;
}

const xmlrequest = new XMLHttpRequest();
xmlrequest.open('GET', 'https://jobs.interspeedia.com/interspeedia/isfeed.php?id=343339373955EF', true);

xmlrequest.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
const ParsedJoblist = new DOMParser().parseFromString(xmlrequest.responseText, "text/xml", );

const joblist = ParsedJoblist.querySelectorAll("jobad");

for (const jobad of joblist){
const id = jobad.querySelector("id").textContent;
const company = jobad.querySelector("company").textContent;
const title = jobad.querySelector("title").textContent;
const location = jobad.querySelector("location").textContent;
const url = jobad.querySelector("url").textContent;
const encodedText = jobad.querySelector("text").textContent;
const decodedText = decodeEntities(encodedText);

const htmlId = `<p style="color: #bfbfbf;">Id: ${id}</p>`
const htmlText = decodedText
const htmlTitle = `<h3>${title}</h3>`
const htmlUrl = `<div class="avia-button-wrap avia-button-center avia-builder-el-140 el_after_av_textblock avia-builder-el-last "><a href="${url}" target="_blank" class="avia-button avia-color-theme-color avia-icon_select-no avia-size-medium avia-position-center "><span class="avia_iconbox_title">Ver más detalles</span></a></div>`
const htmlLocation = `<p><strong>Ubicación:</strong> ${location}</p>`
const htmlCompany = `<p><strong>Empresa:</strong> ${company}</p>`

const htmlJobad = `<tr><td style="padding: 35px; text-align: center;">${htmlId} ${htmlTitle} ${htmlCompany} ${htmlLocation} ${htmlUrl}</td></tr>`

document.querySelector('#output').insertAdjacentHTML('beforeend', htmlJobad)

}
}
};
xmlrequest.send();
</script>
</body>
</html>