undeclaredprefix

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.1: Element ''{0}'' must have no character or element information item [children], because the type''s content type is empty.

Error description in schema standard:

Possible causes for this error:

  • Attribute in element has a prefix used which is not "binded" to any namespace.
    • Binding of prefixes to namespace URIs is inherited by child elements but the elements themselves are not automatically placed in the same namespace as their parent. If they were there would be no way to express an element in a namespace with a child that is not in a namespace. In most cases all the elements that are part of the schema definition need to be in the "http://www.w3.org/2001/XMLSchema" namespace, which is conventionally mapped to either the "xsd" or "xs" prefix.

An example

<DbtrAcct>
   <Id>
      <NWKRadioManagement></NWKRadioManagement>
   </Id>
   <Tp>
      <Cd>CASH</Cd>
   </Tp>
   <Ccy xsi:type="xs:string">AAA</Ccy>
   <Nm>String</Nm>
</DbtrAcct>

Error message: Error UndeclaredPrefix: Cannot resolve 'xs:string' as a QName: the prefix 'xs' is not declared.

How to fix: In this example the "xs" binding has not been declared. Only "xsi" binding exists.

<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03 C:\xml\pain.001.001.03.xsd">

The "xs" binding can be declared the same way as the "xsi" binding.

<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03 C:\xml\pain.001.001.03.xsd">