Fork me on GitHub

验证XML文档的范例代码

如果想变成自己的,就把这里的xml文档名替换成自己xml文档名

var xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async="false";
xmlDoc.validateOnParse="true";
/**********************/
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);

 

posted @ 2017-02-25 10:22  ChangeSub  阅读(235)  评论(0编辑  收藏  举报