JSFiddle - React, Tailwind, and code Playground

by Luke Arrington

HTML

<html>
<head>
	<title>xml example</title>
</head>
<body>
	<h1>This is a simple page</h1>
<div>
	<B> To:</B> <span id="to"></span><br>
	<B> From :</B> <span id="from"></span><br>
	<B> Message: </B> <span id="message"></span><br>
</div>
<script>
	if(window.XMLHttpRequest)
	{
		xmlhttp=new XMLHttpRequest();
	}
	else
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	xmlhttp.open("GET","PS-4-4.txt", false); //this will open our xml file
	xmlhttp.send(); //this will send request to file
	xmlDoc=xmlhttp.responseXML;

	document.getElementById("to").innerHTML=xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue;
	//This will return the tag value
	document.getElementById("from").innerHTML=xmlDoc.getElementsByTagName("from")[0].childNodes[0].nodeValue;
	document.getElementById("message").innerHTML=xmlDoc.getElementsByTagName("message")[0].childNodes[0].nodeValue;
	
</script>
</body>
</html>