xml文件时第一行无缘无故报错

 

 

错误信息:

Referenced file contains errors (http://www.puppycrawl.com/dtds/configuration_1_3.dtd). For more information, right click on the message in the。。。。之类的。

我这里是做的是spring的applicationContext.xml文件的,所以会报spring框架的约束格式错误。

下面总结一下几种解决办法。

第一种:点击eclipse左上角菜单栏 Project->clean 清理一下你所出现问题的项目。不仅这个问题,还有很多奇怪的问题都可以通过这种方式解决

第二种:首先为了确保 Eclipse 可以从远程拿到 xsd 文件,到 Window -> Preferences -> General -> Network Connections -> Cache 下的 Cache entries 框内检查所需要的文件是否正确,如果不确定,就点击 “Remove All”,然后右击当前的 Project 选择 Validator,Eclipse 会重新加载 xsd 文件;

第三种:如果错误依旧,那就需要删掉 xsd 文件的版本号,例如:

http://www.springframework.org/schema/context/spring-context-3.0.xsd

改成: http://www.springframework.org/schema/context/spring-context.xsd

 

posted @ 2019-08-14 11:54  txf-0324  阅读(3737)  评论(0编辑  收藏  举报