I'm trying to validate an XML file via notepad++, and I'm getting following error:
Invalid schema or missing namespace
When I investigated further via another XML validator I get following errors:
Errors in the XML document: 2: 262 cvc-elt.1: Cannot find the declaration of element 'SecondPillarPensionVAPZDeclarationsFile'.
Errors in file xml-schema: 31: 367 TargetNamespace.2: Expecting no namespace, but the schema document has a target namespace of 'http://www.sigedis.be/db2p/declarations/vapz/v1'.
Please find my XML and XSD below:
<?xml version="1.0" encoding="UTF-8"?>
<SecondPillarPensionVAPZDeclarationsFile xmlns="http://www.sigedis.be/db2p/declarations/vapz/v1" xmlns:person="http://kszbcss.fgov.be/types/DB2P/Common/Identification/Person/v3" xmlns:db2p-declarations-common="http://www.sigedis.be/db2p/declarations/common/v1" namespace="http://www.sigedis.be/db2p/declarations/vapz/v1">
<AdministrativeData>
<db2p-declarations-common:DeclarationFileId>000000002</db2p-declarations-common:DeclarationFileId>
<db2p-declarations-common:Sender>0000000000</db2p-declarations-common:Sender>
<db2p-declarations-common:Registrant>0000000000</db2p-declarations-common:Registrant>
<db2p-declarations-common:CreationMoment>2024-04-01T00:42:06+01:00</db2p-declarations-common:CreationMoment>
<db2p-declarations-common:Environment>DB2PSIM</db2p-declarations-common:Environment>
</AdministrativeData>
<Declarations>
<DeclarationVAPZ>
<CreateAccountVAPZ sequence="1">
<RegistrantId>BAL-VA00000000</RegistrantId>
<Regulation>
<SigedisId>2000-0000-0000-0000-0000-0000</SigedisId>
</Regulation>
<Affiliate>
<person:Ssin>00000000000</person:Ssin>
<person:PersonData>
<person:Name>
<person:Name>TEST</person:Name>
<person:FirstName>TEST</person:FirstName>
</person:Name>
<person:Birth>
<person:Date>1990-01-01</person:Date>
<person:BelgianLocation>
<person:Municipality>ANTWERPEN</person:Municipality>
</person:BelgianLocation>
</person:Birth>
<person:Gender>F</person:Gender>
</person:PersonData>
</Affiliate>
<AffiliationDate>2024-04-01</AffiliationDate>
<InvestementTypeReservesInsurer>NoFund</InvestementTypeReservesInsurer>
</CreateAccountVAPZ>
</DeclarationVAPZ>
</Declarations>
</SecondPillarPensionVAPZDeclarationsFile>
XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="https://www.sigedis.be/db2p/declarations/vapz/v1" xmlns:db2p-declarations-common="http://www.sigedis.be/db2p/declarations/common/v1" xmlns:common="http://kszbcss.fgov.be/types/DB2P/Common/v3" targetNamespace="http://www.sigedis.be/db2p/declarations/vapz/v1" elementFormDefault="qualified" version="1.6.3">
<xs:import namespace="http://kszbcss.fgov.be/types/DB2P/Common/v3" schemaLocation="../../Common/Common_v3.xsd"/>
<xs:import namespace="http://www.sigedis.be/db2p/declarations/common/v1" schemaLocation="../common/db2pDeclarationsCommonBaseComponents_v1.xsd"/>
<xs:include schemaLocation="db2pDeclarationsVAPZDeclaration_v1.xsd"/>
<xs:element name="SecondPillarPensionVAPZDeclarationsFile">
<xs:complexType>
<xs:sequence>
<xs:element name="AdministrativeData" type="db2p-declarations-common:AdministrativeDataRequestType"/>
<xs:element name="Declarations" type="DeclarationsTypeVAPZ"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="SecondPillarPensionVAPZDeclarationsResponseFile">
<xs:annotation>
<xs:documentation>Dit element beschrijft het antwoord voor de pensioeninstelling</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="InformationCustomer" type="common:InformationCustomerType">
<xs:annotation>
<xs:documentation>Information block that will be used by the integrator for diagnostic use.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="InformationCBSS" type="common:InformationCBSSType">
<xs:annotation>
<xs:documentation>Information block for CBSS.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="AdministrativeData" type="db2p-declarations-common:AdministrativeDataResponseType"/>
<xs:element name="Status" type="common:StatusType"/>
<xs:element name="DeclarationsResponses" type="DeclarationsResponsesTypeVAPZ" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Can someone take a look and see what's going wrong?
We can't see the whole picture here because the XSD you have shown has some includes and imports of files that you haven't shown us.
However, the fact that it starts by saying it can't find a declaration for your root element name suggests to me that it hasn't found the schema at all.
I'm also deeply suspicious of the fact that your schema has a targetNamespace of
and a default namespace of
Those aren't the same thing, though (without being able to run it myself because it's incomplete) I can't see exactly how it will fail.