【问题标题】:Eclipse Language Servers: There is '1' error in 'javaee_7.xsd'Eclipse 语言服务器:“javaee_7.xsd”中有“1”错误
【发布时间】:2021-04-26 17:52:55
【问题描述】:

当我在 Eclipse Enterprise 版本中创建动态 Web 项目时尝试自动生成 web.xml 文件时,它会显示“语言服务器”类型的错误。它向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 web.xml


【解决方案1】:

这是 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 无法检索(警告消息)并且您遇到错误:

它尝试从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 的位置。不知道是谁干的?

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

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

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

【讨论】:

    猜你喜欢
    • 2021-08-14
    • 2019-02-02
    • 1970-01-01
    • 2021-08-25
    • 2021-04-16
    • 2018-09-13
    • 1970-01-01
    • 2021-04-27
    相关资源
    最近更新 更多