vnk
vnk

Reputation: 67

Validating XML with XSD .Error:Invalid schema or missing namespace

I am getting error while doing the validation using notepad++ . Please see the xml data below. The google drive link below contains the xsd schema files for validation. Thanks in advance. https://drive.google.com/drive/folders/1bK1E04fYdDR7oYTBbnClC56Og2i6VRYD?usp=sharing

Error :

Invalid schema or missing namespace


<Transmission VersionSchema="2019.1" xmlns="http://www.mrq.gouv.qc.ca/T5" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >

<P>

<Annee>2019</Annee>

<TypeEnvoi>O</TypeEnvoi>

<Preparateur>

<No>NP123456</No>

<Type>2</Type>

<Nom1>DNFMDSFJ</Nom1>

<Nom2>SDSDSDD</Nom2>

<Adresse>

<Ligne1>324 </Ligne1>

<Ligne2>107a ave</Ligne2>

<Ville>Surrey</Ville>

<Province>BC</Province>


<CodePostal>V3T0B8</CodePostal>

</Adresse>
</Preparateur>
<Informatique>

<Nom>joseph</Nom>

<IndRegional>604</IndRegional>

<Tel>726-4032</Tel>

<PosteTel>5467</PosteTel>

<Langue>A</Langue>

</Informatique>
<Comptabilite>

<Nom>john doe</Nom>

<IndRegional>604</IndRegional>

<Tel>720-4932</Tel>

<PosteTel>3235</PosteTel>

<Langue>A</Langue>

</Comptabilite>
<NoCertification>RQ-19-99-999</NoCertification>

<NomLogiciel>my company</NomLogiciel>

<VersionLogiciel>1</VersionLogiciel>

<CourrielResponsable>[email protected]</CourrielResponsable>

<CourrielLangue>A</CourrielLangue>


<IdPartenaireReleves>1234567891234567</IdPartenaireReleves>

<IdProduitReleves>1234567891234567</IdProduitReleves>



</P>
<Groupe08>

<R>

<Annee>2019</Annee>

<NoReleve>123456789</NoReleve>

<Etudiant>

<NAS>123456789</NAS>

<CodePermanent>AAAA99999999</CodePermanent>

<NomFamille>george</NomFamille>

<Prenom>joseph</Prenom>

<Initiale>N</Initiale>

</Etudiant>
<Adresse>

<Ligne1>1467 107A AVE</Ligne1>



<Ville>SURREY</Ville>

<Province>BC</Province>

<CodePostal>V379B7</CodePostal>

</Adresse>
<Montants>
Mandatory
<A_EtudesPostSecondaires>2933</A_EtudesPostSecondaires>

<B_FraisScolariteOuExamen>500</B_FraisScolariteOuExamen>

<C_Dons>100</C_Dons>

</Montants>
</R>


<T>

<Annee>2019</Annee>

<NbReleves>1</NbReleves>

<EtablissementEnseignement>

<Code>SDRDFSD</Code>

<Nom1>my college</Nom1>

<Nom2>surrey</Nom2>

<Adresse>

<Ligne1>14527 109ave</Ligne1>



<Ville>surrey</Ville>

<Province>BC</Province>

<CodePostal>V3T0B8</CodePostal>

</Adresse>
</EtablissementEnseignement>
</T>
</Groupe08>
</Transmission>

Upvotes: 0

Views: 7123

Answers (1)

Yitzhak Khabinsky
Yitzhak Khabinsky

Reputation: 22303

I had to download all the XSD files. The main starting point XSD is Transmission.xsd. Initial validation emitted 5 errors.

  1. file:///e:/Temp/vnk/vnk.xml:8,17: Error The 'http://www.mrq.gouv.qc.ca/T5:TypeEnvoi' element is invalid - The value 'O' is invalid according to its datatype 'http://www.mrq.gouv.qc.ca/T5:Indicateur1-4-6Type' - The Enumeration constraint failed.
  2. file:///e:/Temp/vnk/vnk.xml:61,14: Error The element 'Montants' in namespace 'http://www.mrq.gouv.qc.ca/T5' cannot contain text. List of possible elements expected: 'A_EtudesPostSecondaires, B_FraisScolariteOuExamen, C_Dons' in namespace 'http://www.mrq.gouv.qc.ca/T5'.
  3. file:///e:/Temp/vnk/vnk.xml:62,36: Error The 'http://www.mrq.gouv.qc.ca/T5:A_EtudesPostSecondaires' element is invalid - The value '2933' is invalid according to its datatype 'String' - The Pattern constraint failed.
  4. file:///e:/Temp/vnk/vnk.xml:63,36: Error The 'http://www.mrq.gouv.qc.ca/T5:B_FraisScolariteOuExamen' element is invalid - The value '500' is invalid according to its datatype 'http://www.mrq.gouv.qc.ca/T5:Decimal9Type' - The Pattern constraint failed.
  5. file:///e:/Temp/vnk/vnk.xml:64,18: Error The 'http://www.mrq.gouv.qc.ca/T5:C_Dons' element is invalid - The value '100' is invalid according to its datatype 'http://www.mrq.gouv.qc.ca/T5:Decimal9Type' - The Pattern constraint failed.

I fixed all the errors. Here is your valid XML file.

XML

<?xml version="1.0"?>
<Transmission VersionSchema="2019.1" xmlns="http://www.mrq.gouv.qc.ca/T5"
              xmlns:xsd="http://www.w3.org/2001/XMLSchema"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://www.mrq.gouv.qc.ca/T5 Transmission.xsd">
    <P>
        <Annee>2019</Annee>
        <TypeEnvoi>1</TypeEnvoi>
        <Preparateur>
            <No>NP123456</No>
            <Type>2</Type>
            <Nom1>DNFMDSFJ</Nom1>
            <Nom2>SDSDSDD</Nom2>
            <Adresse>
                <Ligne1>324</Ligne1>
                <Ligne2>107a ave</Ligne2>
                <Ville>Surrey</Ville>
                <Province>BC</Province>
                <CodePostal>V3T0B8</CodePostal>
            </Adresse>
        </Preparateur>
        <Informatique>
            <Nom>joseph</Nom>
            <IndRegional>604</IndRegional>
            <Tel>726-4032</Tel>
            <PosteTel>5467</PosteTel>
            <Langue>A</Langue>
        </Informatique>
        <Comptabilite>
            <Nom>john doe</Nom>
            <IndRegional>604</IndRegional>
            <Tel>720-4932</Tel>
            <PosteTel>3235</PosteTel>
            <Langue>A</Langue>
        </Comptabilite>
        <NoCertification>RQ-19-99-999</NoCertification>
        <NomLogiciel>my company</NomLogiciel>
        <VersionLogiciel>1</VersionLogiciel>
        <CourrielResponsable>[email protected]</CourrielResponsable>
        <CourrielLangue>A</CourrielLangue>
        <IdPartenaireReleves>1234567891234567</IdPartenaireReleves>
        <IdProduitReleves>1234567891234567</IdProduitReleves>
    </P>
    <Groupe08>
        <R>
            <Annee>2019</Annee>
            <NoReleve>123456789</NoReleve>
            <Etudiant>
                <NAS>123456789</NAS>
                <CodePermanent>AAAA99999999</CodePermanent>
                <NomFamille>george</NomFamille>
                <Prenom>joseph</Prenom>
                <Initiale>N</Initiale>
            </Etudiant>
            <Adresse>
                <Ligne1>1467 107A AVE</Ligne1>
                <Ville>SURREY</Ville>
                <Province>BC</Province>
                <CodePostal>V379B7</CodePostal>
            </Adresse>
            <Montants>
                <A_EtudesPostSecondaires>2933.00</A_EtudesPostSecondaires>
                <B_FraisScolariteOuExamen>500.00</B_FraisScolariteOuExamen>
                <C_Dons>100.00</C_Dons>
            </Montants>
        </R>
        <T>
            <Annee>2019</Annee>
            <NbReleves>1</NbReleves>
            <EtablissementEnseignement>
                <Code>SDRDFSD</Code>
                <Nom1>my college</Nom1>
                <Nom2>surrey</Nom2>
                <Adresse>
                    <Ligne1>14527 109ave</Ligne1>
                    <Ville>surrey</Ville>
                    <Province>BC</Province>
                    <CodePostal>V3T0B8</CodePostal>
                </Adresse>
            </EtablissementEnseignement>
        </T>
    </Groupe08>
</Transmission>

Upvotes: 3

Related Questions