The getAttributeNS of Element for JS returns element’s attribute whose namespace is namespace and local name is localName, and null if there is no such attribute otherwise.
element.getAttributeNS(namespace, localName) A null or a non-empty string.
<!doctype html>
<html>
<body>
<output></output>
<script>
function myfunction()
{
const element = this.responseXML.querySelector("first");
const namespace = "https://osbo.com";
const localName = "id";
document.querySelector("output").innerHTML = element.getAttributeNS(namespace, localName);
}
const client = new XMLHttpRequest();
client.onload = myfunction;
client.open("GET", "/assets/xml/namespace.xml");
client.send();
</script>
</body>
</html>