Eclipse语言服务器:“javaee_7.xsd”中有“1”错误

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

<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 中的一个错误,自 2021-03 年以来就出现了。

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

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

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

有一个警告:

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(警告消息),并且出现错误:

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

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

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

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


以上是Eclipse语言服务器:“javaee_7.xsd”中有“1”错误的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>