Referenced file contains errors(非删除校验)

Z问题如下:

  提示信息   :  

Description   Resource   Path   Location   Type

Referenced file contains errors (file:/E:/learn/file/spring_relative/spring-framework-4.2.4.RELEASE-dist/spring-framework-4.2.4.RELEASE/schema/context/spring-context-3.2.xsd).  For more information, right click on the message in the Problems View and select "Show Details..." applicationContext.xml   /spring4_day02/src   line 1 XML Problem

  如图:

Referenced file contains errors(非删除校验)

 

W解决:

解决方法一:连接网络。 (治标不治本,没有网络时依旧显示错误)

当没有网络时,由于context/spring-context-3.2.xsd文件并没有加入到IDE中,当前的编程工具无法找到相关的文件的信息,所以会出现这种错误提示。

有网络时,IDE工具   通过访问  http://www.springframework.org/schema/context/spring-context.xsd (在约束中),如下图所示标红的位置。获取相关xsd文件的信息。

Referenced file contains errors(非删除校验)

没有网络时,修改一部分,依旧会出错。所以本方法不能从根本上解决问题。

解决方法二:添加xml Catalog 

 我用的是eclipse2019,下面以2019为例。其他的工具并未使用,敬请谅解

1. 选中window  , 在弹出的下拉菜单中选择“Preferences”,如下图所示

Referenced file contains errors(非删除校验)

弹出如下名字为"Preferences"对话框,在①号框中输入xml Catalog  (注意xml Catalog中间有个空格),点击回车,选中②处标的位置,双击,弹出右侧“XML Catlog”对话框,选中User Specified Entries ,然后点击“Add”.

Referenced file contains errors(非删除校验)

之后会弹出一个名为“Edit XML Catalog Element”的对话框。如下图所示:

Referenced file contains errors(非删除校验)

1. 在"Location"框中(上图①处)输入所使用的约束的具体位置(必须在本地有相关文件,当然也可以单击“File System...” 找到 

     相关文件后双击),spring相关的约束在spring_relative\spring-framework-4.2.4.RELEASE-schema\context 的下一级目录.

     我的是spring_relative\spring-framework-4.2.4.RELEASE-schema\context\spring-context-3.2.xsd

     注意!!!!处所指的位置版本要与项目所使用的版本相同.

2.  “Key type”中(上图②处),点击①(下图)处,在弹出的下拉菜单中选择“Schema location”(如下图所示)(只限于Spring约束,其他的框架的话下拉菜单中的内容可能会不同)

3.  上述操作完成后,在“Key”中(上图③处),将相关信息添加进去我的是http://www.springframework.org/schema/context/spring-context.xsd,然后点击“OK”,就可以了

 

Referenced file contains errors(非删除校验)

T注意:

1. 非spring可能会有所不同

2. 当User Specified Entries有多个值时,可能会发生冲突,我的就因为  同时加入了 spring-beans-3.2.xsd和spring-context-

    3.2.xsd 产生冲突,导致依然出错。后来根据自己使用的信息进行选择。

3. 希望我的文章对你有用,如果你按照我的操作解决自己的问题后可以转载(当然,如果想做自己的原创,请稍微修改后在发布,谢谢),但是如果为解决实际问题,欢迎探讨。小白一枚,如表达有误,欢迎指出。

 

                                                                                       --2019--06--03