<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function initXml(){
var xmldoc = new ActiveXObject("Microsoft.XMLDOM");
xmldoc.validateOnParse = "true";
/**********修改成自己的xml文件*****************/
xmldoc.load("book.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>
</head>
<body οnlοad="initXml();">
</body>
</html>
通过javascript校验XML文件语法是否正确
最新推荐文章于 2019-03-11 19:23:33 发布