cvc-complex-type.2.4.c

Notice! This page describes the nature of the error using a hypothetical example and not the erroneous data of the input test file. You should however be able to apply this information to your error case.

General description of the error:

The format of the error message: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element ''{0}''.

Error description in schema standard: http://www.w3.org/TR/2007/WD-xmlsche...c-complex-type

Possible causes for this error:

  • Schema has a structure where 'xs:any' is used and 'processContents="strict"' is used. Validated file has element with child elements under it that are not defined in schema.

An example

Even though 'xs:any'-structure allows for any elements to appear in any order, together with 'processContents="strict"' they still have to be introduced in the schema or the payment file containing child elements is not valid.

  • strict: the XML processor must obtain the schema for the required namespaces and validate the elements (this is default).
  • lax: same as strict but if the schema cannot be obtained, no errors will occur.

Schema definition:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:element name="model">
        <xs:complexType>
            <xs:sequence>
               <xs:any processContents="strict" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

The XML file:

<model>
  <sub_element>value</sub_element>
</model>

Error message:Error cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'sub_element'.

How to fix: Only elements defined in the schema can be used. It is recommended to check the schema which elements are allowed and only use those. In this case schema doesn't allow any elements to be used under it. So removing the element "sub_element" from uploaded file will pass the schema check.

Schema:

<model></model>