the root element of the document is not <xsd:schema>
Asked Answered
M

1

6

I have a file named jvxml-implementation-0-7.xsd in my project.

The contents of the file are

<?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>

But when it is being loaded such an error occurs.

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>.

I have changed the permission and put the file where it is suppoesed to be. So I am left with the third error.

Please give me an insight on how to deal with it.

Regards.

Micelle answered 8/6, 2012 at 9:22 Comment(1)
R
4

XSI is a schema instance reference - not a schema.

1 of 2 things will work here.

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

OR

  1. Change <xsi:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema" to <xsd:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema" and replace all "xsi" with "xsd"
Rosinski answered 20/11, 2013 at 15:7 Comment(1)
I would like to add a small point here, I was facing the same issue but what I have missed was an improper filePath to both XSD and XML. please don't be an idiot like me to do like above.Carolincarolina

© 2022 - 2024 — McMap. All rights reserved.