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:
cvc-complex-type.2.4.a: Invalid content was found starting with element ''{0}''. One of ''{1}'' is expected.
Error description in schema standard: http://www.w3.org/TR/2007/WD-xmlsche...c-complex-type
Possible causes for this error:
- Element name is mistyped.
- Mandatory element is missing
- The end tag for an earlier element is missing
- Element not described in schema is trying to be used.
- One reason for the above could be that not all of the expected elements are given. E.g. InitgPty/PstlAdr/Ctry is expected, instead InitgPty/Ctry is given
- Elements are in incorrect order.
- Namespace definitions declared either in the root tag or a parent element don't match with the prefix (or no prefix) used in the element.
An example
In this example, elements "House" and "Garage" are defined in the namespace "house.ns". "Car" and "Brand" belong to the "car.ns" namespace.
Incorrect:
<House xmlns="http://house.ns" xmlns:car="http://car.ns">
<Garage>
<Car> <!-- This element is defined in the "car.ns" namespace. Therefore its name should be typed as "car:Car" -->
<Brand>BMW</Brand> <!-- Same thing here -->
</Car>
</Garage>
</House>
Fixed:
<House xmlns="http://house.ns" xmlns:car="http://car.ns">
<Garage>
<car:Car>
<car:Brand>BMW</car:Brand>
</car:Car>
</Garage>
</House>
An alternative way is to declare namespaces where they're going to be used. This is a way to avoid using namespace prefixes in elements:
<House xmlns="http://house.ns">
<Garage>
<Car xmlns="http://car.ns">
<Brand>BMW</Brand>
</Car>
</Garage>
</House>
An example
<PstlAdr>
<AdrType>ADDR</AdrType>.
</PstlAddr>
Error message: Error cvc-complex-type.2.4.a: Invalid content was found starting with element 'AdrType'. One of '{"urn:iso:std:iso:20022:tech:xsd:pain.001.001.03":AdrTp, "urn:iso:std:iso:20022:tech:xsd:pain.001.001.03":Dept, "urn:iso:std:iso:20022:tech:xsd:pain.001.001.03":SubDept, "urn:iso:std:iso:20022:tech:xsd:pain.001.001.03":StrtNm, "urn:iso:std:iso:20022:tech:xsd:pain.001.001.03":BldgNb, "urn:iso:std:iso:20022:tech:xsd:pain.001.001.03":PstCd, "urn:iso:std:iso:20022:tech:xsd:pain.001.001.03":TwnNm, "urn:iso:std:iso:20022:tech:xsd:pain.001.001.03":CtrySubDvsn, "urn:iso:std:iso:20022:tech:xsd:pain.001.001.03":Ctry, "urn:iso:std:iso:20022:tech:xsd:pain.001.001.03":AdrLine}' is expected.
How to fix: This issue can be fixed by using one of the elements suggested by the error message. Further information can be found from the schema definition.
<PstlAdr>
<AdrTp>ADDR</AdrTp>
</PstlAdr>