源代码 :
点击运行
<html> <body> <h3> This demonstrates a parser error: </h3> <script> var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async="false"; xmlDoc.validateOnParse="true"; xmlDoc.load("note_dtd_error.xml"); document.write("<br>Error Code: "); document.write(xmlDoc.parseError.errorCode); document.write("<br>Error Reason: "); document.write(xmlDoc.parseError.reason); document.write("<br>Error Line: "); document.write(xmlDoc.parseError.line); </script> </body> </html>
运行结果