Question: / / Fetch current headlines from the web server fetch ( headlines . xml ) . then ( response = > response.text (

// Fetch current headlines from the web server
fetch ("headlines.xml")
.then (response => response.text())
.then (str => new DOMParser().parseFromString(str, "text/xml"))
// Write the XML content to HTML
then (dom
let items = dom.querySelectorAll("item");
//Loop through each story item
for (let story of items){
//Write the story content and append it to the page
let headline = story * children[0].textContent;
let link = story * children[1].textContent;
let summary = story.children[2].textContent;
newS.insertAdjacentHTML("beforeend", htmlCode);
}
});
// i does not prin the html code properly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!