XML学习札记--Parser Errors
2004-10-30 23:29
771 查看
The parseError Object
当您尝试打开一个XML文档的时候,XML解析器可能会发现文档中存在某些错误,通过访问parseError对象,将返回一些值,如error code,error text,error line等
Example
使用如下代码,load非现成的xml文档或者load一个现成的存在xml语法错误的xml文档,按照 实际情况将会有不同的结果.
The parseError Properties
当您尝试打开一个XML文档的时候,XML解析器可能会发现文档中存在某些错误,通过访问parseError对象,将返回一些值,如error code,error text,error line等
Example
使用如下代码,load非现成的xml文档或者load一个现成的存在xml语法错误的xml文档,按照 实际情况将会有不同的结果.
<script language="JavaScript" type="text/JavaScript"> var xmlDoc = new ActiveXObject("Microsoft.XMLDOM") xmlDoc.async="false" xmlDoc.load("note_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) document.write("<br>Error linePos: ") document.write(xmlDoc.parseError.linePos) document.write("<br>Error srcText: ") document.write(xmlDoc.parseError.srcText) document.write("<br>Error url: ") document.write(xmlDoc.parseError.url) document.write("<br>Error filePos: ") document.write(xmlDoc.parseError.filePos) </script> |
Property | Description |
errorCode | Returns a long integer error code |
reason | Returns a string explaining the reason for the error |
line | Returns a long integer representing the line number for the error |
linePos | Returns a long integer representing the line position for the error |
srcText | Returns a string containing the line that caused the error |
url | Returns the url pointing the loaded document |
filePos | Returns a long integer file position of the error |
相关文章推荐
- JavaScript封装的常用工具类库bee.js用法详解【经典类库】
- VC与Delphi之间动态链接库互相调用
- 用Ole Automation实现Delphi和AutoCad之间的数据交换
- javascript表单之间的数据传递!
- 如何用VB获得机器的MAC地址
- Java测试规范(引用)
- Java面试题目
- delphi中的时间操作技术(1)
- delphi中的时间操作技术(2)
- VB五子棋问题,请高手赐教
- IP地址的隐藏(delphi实现 )
- DirectX.Capture
- 解析IP地址为主机域名
- 将某一主机域名解析为IP地址
- 在做控件的存取控制时碰到的问题,请教各位!
- Struts tags (4) ----Html(2)
- 有关TrueDBGrid的问题向各位大虾请教