async function fnc() { const file = await fetch('sample.xml'); console.log(file); const text = await file.text(); console.log(text); const xml = new DOMParser().parseFromString(text, 'application/xml'); console.log(xml); }; fnc();