通过javascript校验XML文件语法是否正确

来源:互联网 发布:js取整 编辑:程序博客网 时间:2024/05/24 06:27
<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 onload="initXml();"></body></html>

0 0
原创粉丝点击