[eclipse]org.eclipse.wst.internet.cache中.cache文件丢失导致XML编辑时dtd无法识别

问题描述:

    今天突然编辑struts工程的xml文件,dtd相应的内容无法快捷提示了,warn提示如下:

The file cannot be validated as the XML definition "/home/wenlele/workspace/.metadata/.plugins/org.eclipse.wst.internet.cache/789059000.cache (没有那个文件或目录)" that is specified as.describing the syntax of the file cannot be located.


解决过程:

    去找了相应的文件夹,发现文件夹中并没有相应的文件,但cache.xml文件中记录了struts2-2.0.dtd的cache信息:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><cache><entry expirationTime="1334638694044" lastModified="1327617544000" location="789059000.cache" uri="http://struts.apache.org/dtds/struts-2.0.dtd"/></cache>



    把相应的entry内容删除,重新打开工程,就会创建新的cache文件,便解决此问题。




PS:相应的.cache文件的内容就是uri指向的文件内容,为uri文件在本地的缓存。struts2配置xml文件加载dtd文件信息时,如果在cache.xml中记录相应dtd的本地缓存,则会先找本地缓存文件;如果没有,则在线获取,并创建缓存文件。但,如果cache.xml记录有缓存,但实际不存在相应的缓存文件,则会报warning。觉得这样的实现不太合理,应该本地找不到缓存文件,应该新下载内容,更新缓存文件。

PS2:cache.xml的官方说明:

    The cached files are located in WORKSPACE_DIR/.metadata/.plugins/org.eclipse.wst.internet.cache. The entries are all named with numbers but you can see the mappings in the cache.xml file located in the same directory.


PS3:似乎只影响eclipse编辑xml内容时无法使用快捷提示,对编译运行无影响。所以,eclipse只提示warn,而非error。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值