web.xml的Bogus Eclipse警告:“为文档检测不到语法约束(DTD或XML模式)”。 [英] Bogus Eclipse warning for web.xml: "No grammar constraints (DTD or XML schema) detected for the document."

查看:179
本文介绍了web.xml的Bogus Eclipse警告:“为文档检测不到语法约束(DTD或XML模式)”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 web.xml 文件的顶部如下所示:

 <?xml version =1.0encoding =UTF-8?> 
< web-app xmlns =http://java.sun.com/xml/ns/j2ee
xmlns:xsi =http://www.w3.org/2001/XMLSchema -instance
xsi:schemaLocation =http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd
version =2.5>但是我仍然收到来自Eclipse(Ganymede)的警告,指出没有检测到XML模式,并且违反了模式。没有被警告。我的项目中的其他XML文件(例如 Spring Framework 配置文件)没有警告和请确保对模式违规提出正确的警告。



如何让模式检查工作,并希望警告消失?服务器运行正常。它似乎是一个IDE问题。

解决方案

也许尝试:

  http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd 

而不是:

  http://java.sun.com/xml/ ns / j2ee / web-app_2_5.xsd 






另外,<!DOCTYPE ...> 缺少:

 <?xml version =1.0encoding =UTF-8?> 
<!DOCTYPE xml>
< web-app
xmlns =http://java.sun.com/xml/ns/j2ee
xmlns:xsi =http://www.w3.org / 2001 / XMLSchema-instance
xsi:schemaLocation =http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5 .xsd
version =2.5>
<! - ... - >
< / web-app>


The top of my web.xml file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"
    version="2.5">

But I still get the warning from Eclipse (Ganymede) that no XML schema is detected, and schema violations are not being warned about. Other XML files in my project (Spring Framework configuration files for example) don't have the warning and do give correct warnings about schema violations.

How do I get the schema checking working and hopefully the warning to go away? The server does run correctly. It just appears to be an IDE issue.

解决方案

Perhaps try:

http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd

Instead of:

http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd


Also, the <!DOCTYPE ...> is missing:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<web-app
  xmlns="http://java.sun.com/xml/ns/j2ee" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  version="2.5">
  <!-- ... -->
</web-app>

这篇关于web.xml的Bogus Eclipse警告:“为文档检测不到语法约束(DTD或XML模式)”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆