This is what I have created. It appears the script never gets to the Data:
!DOCTYPE html>
<html>
<head>
<title>XML Feed </title>
<script>
// Fetch and parse the XML feed
function fetchXMLFeed() {
fetch('https://solidsports.com.au/scores/Venue_GPS/live/Scores.xml')
.then(response => response.text())
.then(data => {
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(data, 'text/xml');
const items = xmlDoc.getElementsByTagName('item');
// Iterate through each item and display the description for the needed titles
let descriptionContainer = document.getElementById('description-container');
for (let i = 0; i < items.length; i++) {
let title = items[i].getElementsByTagName('title')[0].textContent;
let descript = items[i].getElementsByTagName('description')[0].textContent;
if (`your text`title === 'AwayPoints') {
descriptionContainer.textContent = descript;
break;
}
}
})
.catch(error => {
console.error('Error fetching XML feed:', error);
});
}
</script>
</head>
<body onload="fetchXMLFeed()">
<h2>Description for Item with Title "AwayPoints":</h2>
<div id="description-container"></div>
</body>
</html>
the html code does not provide any output I have tried adding elements within the Data =>{} construct and displaying them in the html. It appears the script never gets to the data. I am sure there is something simple I am not doing, but being new to this I can't figure it out. Any help or comments would be greatfully received. Thanks