代码改变世界

MyBatis的配置文件提示相关dtd文件未找到

2019-10-29 16:45  pere  阅读(1563)  评论(0)    收藏  举报

问题:The file cannot be validated as the XML definition "D:\xx\xx\(系统找不到指定的路径。)" that is specified as describing the syntax of the file  cannot be located.

解决方法:

以配置mapper文件为例"http://mybatis.org/dtd/mybatis-3-mapper.dtd">

1、引入的jar包为mybatis-3.2.2.jar,引入后工程里面有mybatis-3-mapper.dtd文件,其路径为mybatis-3.2.2.jar1\org\apache\ibatis\builder\xml

2、复制http://mybatis.org/dtd/mybatis-3-mapper.dtd,然后到MyEclipse中,打开windows —Preference  —   XML   —  XML  Catalog —选择右边栏中的 Add  按钮,—  Key Type 选择  URI,Key  中粘贴刚才引号中内容  —然后点击   File System   按钮,找到我们解压出来那个  mybatis-3-config.dtd   文件  ->  然后就是  OK确定,->  到 eclipse 中,关闭掉 xml文件后再次打开,然后Alt  + /  ,会出现所有的标签属性提示!!!