Eclipse 语言服务器:“javaee_7.xsd"中有“1"错误 [英] Eclipse Language Servers: There is '1' error in 'javaee_7.xsd'

查看:119
本文介绍了Eclipse 语言服务器:“javaee_7.xsd"中有“1"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 Eclipse Enterprise 版本中创建动态 Web 项目时尝试自动生成 web.xml 文件时,它显示了语言服务器"类型的错误.它向 web.xml 文件的此元素指示错误:

When I try to auto generate the web.xml file while creating a Dynamic Web Project in the Eclipse Enterprise version it shows an error of type "Language Servers". It indicates to this element of the web.xml file as error:

<web-app
    xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
    version="4.0"
>

  • javaee_7.xsd"中存在1"错误.
  • schema_reference.4: 无法读取架构文档platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd",因为 1) 找不到文档;2)文件不能读;3) 文档的根元素不是 xsd:schema.).

推荐答案

这是 Eclipse 中的一个 bug,自 2021 年 3 月起出现.

This is a bug in Eclipse which manifested since 2021-03.

它在这里分解:https://github.com/eclipse/lemminx/issues/1042#issuecomment-859778034:

好的,我可以用一个新的 Eclipse IDE(最后一个)重现这个问题.我可以解释这个问题,但我不知道如何解决它(目前).

Ok I can reproduce the issue with a fresh Eclipse IDE (the last). I can explain the problem but I don't know how to fix it (for the moment).

当您有 There is '1' error in 'jakartaee_9.xsd'" 错误时,您必须打开 XSD 文件(从缓存中),您应该看到 1 个错误和 1 个错误警告:

When you have "There is '1' error in 'jakartaee_9.xsd'" error, you must open the XSD file (from the cache) and you should see 1 error and 1 warning:

有一个警告:

schema_reference.4: Failed to read schema document 'platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.  jakartaee_9.xsd /lemminx-cache/https/jakarta.ee/xml/ns/jakartaee    line 52 Language Servers

尝试在 xml.xsd 文件中定义 xml:lang 属性.但是这里无法检索 xml.xsd(警告消息),并且出现错误:

which try to define xml:lang attribute inside xml.xsd file. But here the xml.xsd cannot be retrieved (the warning message) and you have the error:

它尝试从 platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd 下载 XSD,但平台特定于 Eclipse IDE.换句话说,当必须解析 http://www.w3.org/2001/xml.xsd 时,它说 platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd 是 XSD 的位置.我不知道是谁做的?

It tries to download the XSD from platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd but platform is specific to Eclipse IDE. In other words when http://www.w3.org/2001/xml.xsd must be resolved, it says that platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd is the location of XSD. I don't know who do that?

我的印象是 LemMinx 被配置为使用来自 WTP 的 XML 目录:

I have the impression than LemMinx is configured to use XML catalog from WTP:

在等待带有修复程序的 Eclipse 版本(在撰写本文时确实尚未发布)时,一种解决方法是禁用 LemMinx 验证:

While waiting for the Eclipse version with the fix (which is indeed not yet released at the time of writing), one work around is disable the LemMinx validation:

@chris21k 请注意,您可以禁用 LemMinx 验证:

@chris21k please note that you can disable LemMinx validation:

这篇关于Eclipse 语言服务器:“javaee_7.xsd"中有“1"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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