cvc-complex-type-2-4-b
Table of contents
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.
This could practically mean some of the following cases:
- The element name was misspelled. Here the element was intended to be elem4, but for some reason it was typed as elem3. Check spelling.
- 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.
- 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:
- There is a limit for elem3 instances and you have used more than allowed.
![]() | Mandatory elements here are: StrtNm, PstCd, TwnNm and Ctry. If you used only Ctry: <PstlAdr> Validator's error message would be like this:
|
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.