xmlxsd

SAXParseException: cvc-elt.1: Cannot find the declaration of element 'Document'


I have this issue

Caused by: 

 org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'Document'.

The document in XML

<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="urn:swift:xsd:setr.010.001.03">

My XSD

<?xml version="1.0" encoding="UTF-8"?>
<!--Generated by Standards Editor (build:R1.0.42.1) on 2013 May 24 16:27:15, ISO 20022 version : 2013-->
<xs:schema xmlns="urn:iso:std:iso:20022:tech:xsd:setr.010.001.03" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:iso:std:iso:20022:tech:xsd:setr.010.001.03">
    <xs:element name="Document" type="Document"/>

I have a problem of ns. Any idea please ?

Regards


Solution

  • The namespace of the root element,

              xmlns="urn:swift:xsd:setr.010.001.03"
    

    must match the target namespace of the XSD,

    targetNamespace="urn:iso:std:iso:20022:tech:xsd:setr.010.001.03"
    

    but does not, which leads to the failure to find the declaration of the root element.