当前位置:编程学习 > XML/UML >>

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

问题描述:

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

[plain]
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信息:
[html]
<?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文件,便解决此问题。

 

 

PS1:相应的.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。


摘自 wenlele的专栏
补充:Web开发 , 其他 ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,