JSFiddle - React, Tailwind, and code Playground
JavaScript
var doc = new DOMParser().parseFromString('<root><foo xml:id="f1">foo 1<\/foo><\/root>', 'application/xml');
var foo1 = doc.getElementById('f1');
var p = document.createElement('p');
p.textContent = 'getElementById() found ' + foo1 + '.';
document.body.appendChild(p);