<html> <body> <script type="text/javascript"> xmlDoc=document.implementation.createDocument("","",null); xmlDoc.async=false; xmlDoc.load("note_error.xml"); if (xmlDoc.documentElement.nodeName=="parsererror") { errStr=xmlDoc.documentElement.childNodes[0].nodeValue; errStr=errStr.replace(/</g, "<"); document.write(errStr); } else { document.write("XML is valid"); } </script> </body> </html>
Your Result:
Edit the code above and click to see the result.
W3Schools.com
- Try it yourself