currently I am trying to validate my XML against my XSD, however, I am getting always this error message:
Cannot Find The Declaration Of Element 'Document'., Line '1', Column '11'.
and I do not know/understand how to fix it?
Here is my XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="rn:iso:std:iso:20022:tech:xsd:uth.30.01.3" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="rn:iso:std:iso:20022:tech:xsd:uth.30.01.3">
<xs:element name="Document" type="Document"/>
<xs:simpleType name="ActiveCurrencyCode">
<xs:annotation>
<xs:documentation source="Name" xml:lang="EN">ActiveCurrencyCode</xs:documentation>
<xs:documentation source="Definition" xml:lang="EN">A code allocated to a currency by a Maintenance Agency under an international identification scheme as described in the latest edition of the international standard ISO 4217 "Codes for the representation of currencies and funds".</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z]{3,3}"/>
</xs:restriction>
</xs:simpleType>
and here goes the XML
<?xml version='1.0' encoding='utf-8'?>
<Document>
<DerivsTradRpt>
<RptgTmStmp>2024-03-13T13:24:23Z</RptgTmStmp>
<TradData>
<Rpt>
...
</TradData>
</DerivsTradRpt>
</Document>
Maybe, someone can help me, please!
Thank you very much in advance.
You have a schema with a target namespace (targetNamespace="rn:iso:std:iso:20022:tech:xsd:uth.30.01.3"
), additionally the schema declares elementFormDefault="qualified"
, so your instance needs to use e.g.
<Document xmlns="rn:iso:std:iso:20022:tech:xsd:uth.30.01.3">..</Document>