文档的根元素不是<xsd:schema>

Abh*_*hek 6 java spring ivr

我的项目中有一个名为jvxml-implementation-0-7.xsd的文件.

该文件的内容是

<?xml version="1.0" encoding="UTF-8"?>
<xsi:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema"
 xmlns="http://www.jvoicexml.org/xsd/jvxml-implementation-0-7.xsd"
   xmlns:tns="http://www.example.org/jvxml-implementation"    
xmlns:beans="http://www.springframework.org/schema/beans"
  elementFormDefault="qualified">
  <xsi:import namespace="http://www.springframework.org/schema/beans"
    schemaLocation="spring-beans-2.0.xsd" />
  <xsi:element name="implementation">
    <xsi:annotation>
      <xsi:documentation>
    Implementation platform for JVoiceXML
  </xsi:documentation>
</xsi:annotation>
<xsi:complexType>
  <xsi:sequence minOccurs="0" maxOccurs="unbounded">
    <xsi:element name="repository" type="xsi:string"
      minOccurs="0" maxOccurs="1">
      <xsi:annotation>
        <xsi:documentation>
          The name of the loader repository.
        </xsi:documentation>
      </xsi:annotation>
    </xsi:element>
    <xsi:element name="classpath" type="xsi:string"
      minOccurs="0" maxOccurs="unbounded">
      <xsi:annotation>
        <xsi:documentation>
          Entry to be added to the CLASSPATH when
          loading this implementation platform^M
        </xsi:documentation>
      </xsi:annotation>
    </xsi:element>
    <xsi:element ref="beans:bean" minOccurs="1"
      maxOccurs="unbounded">
      <xsi:annotation>
        <xsi:documentation>Spring bean configuration
        </xsi:documentation>
      </xsi:annotation>
    </xsi:element>
  </xsi:sequence>
</xsi:complexType>
Run Code Online (Sandbox Code Playgroud)

但是当它被加载时会发生这样的错误.

org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'jvxml-implementation-0-7.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>.
Run Code Online (Sandbox Code Playgroud)

我已经更改了权限并将文件放在它所支持的位置.所以我留下了第三个错误.

请给我一个如何处理它的见解.

问候.

小智 4

XSI 是模式实例引用 - 不是模式。

两件事中的一件在这里会起作用。

  1. 改成<xsi:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema"<xsi:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

或者

  1. 更改<xsi:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema"<xsd:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema" 并将所有“xsi”替换为“xsd”

  • 我想在这里添加一个小点,我面临着同样的问题,但我错过的是 XSD 和 XML 的文件路径不正确。请不要像我一样白痴做上面那样的事情。 (2认同)