Page last modified 03:27, 23 Oct 2012 by Jussi

cvc-complex-type-2-4-b

    Table of contents
    No headers

    Version as of 07:38, 27 Jun 2022

    to this version.

    Return to Version archive.

    View current version

    Error description:

    There is a wrong element, an element is missing or there is an unwanted element present at this location. Which one is the case depends on the message given by validator

     

    Explanation of the error message given by the validator:

    "Element 'elem1': Missing child element(s). Expected is( elem2 )."

    Where elem1 corresponds to the location where the error was detected, and elem2 is the child element missing.

     


     

    Element 'elem3': This element is not expected. Expected is ( elem4 )

    This could practically mean some of the following cases:

    1. The element name was misspelled. Here the element was intended to be elem4, but for some reason it was typed as elem3. Check spelling.
    2. elem4 is defined mandatory in the xml schema the file is trying to be validated against, but it can't be found in the xml file itself. There may not necessarily be anything wrong with elem3, other than the fact that something is missing before it. So elem3 is only where you should be looking for in order to pinpoint the location where the element, in this case elem4, is missing.
    3. It could also be that there is a mandatory element missing before elem3. In this case listed element elem4 could be one of the elements which are allowed to be before the other mandatory element, not mentioned in the error message. An example below next to the picture:
    4. There is a limit for elem3 instances and you have used more than allowed.
    error1871.png

    Mandatory elements here are: StrtNm, PstCd, TwnNm and Ctry. If you used only Ctry:

    <PstlAdr>
         <Ctry>FI</Ctry>
    </PstlAdr>

    Validator's error message would be like this:

    Element 'Ctry': This element is not expected. Expected is one of ( AdrTp, AdrLine, StrtNm ).

    Meaning that the validator is expecting a mandatory element (StrtNm), and the other two elements listed are optional and can be used before it.

     


     

    Element 'elem5': This element is not expected.

    Where elem5 is an element that is not allowed to be at this location. As in the previous case, the error could be caused by a typing error or a missing mandatory element.

    Additionally, the error could originate from a situation where there is a set of choice type of elements (only one can be used at a time) defined in the xml schema, and more than one of them are being used in the xml instance.

    Menu