如果xml文件有格式错误的话,排查起来很困难,就像有的时候英文符号写成了中文,这种问题坑的一比。今天就遇到了eclipse报错

org.xml.sax.SAXParseException: Element type "result" must be followed by either attribute specifications, ">" or "/>".

眼睛盯花了也找不到问题所在。

后来想起还有一招,就是

把文件用浏览器打开

浏览器可以直接把错误位置标示出来:

This page contains the following errors:
error on line 8 at column 67: error parsing attribute name
Below is a rendering of the page up to the first error.

错误在第8行第67列,然后发现/>被写成了.> (=。=)