SEPA XSD - Empty Enumeration with Minimum Length

37 views Asked by At
  <xs:simpleType name="ExternalPurpose1Code">
    <xs:restriction base="xs:string">
      <xs:minLength value="1"/>
      <xs:maxLength value="4"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="ExternalPurpose1Code_EPC121-16_2023_V1.0_SCT_Inst_C2P">
    <xs:restriction base="ExternalPurpose1Code">
      <xs:enumeration value=""/>
    </xs:restriction>
  </xs:simpleType>

When we use ExternalPurpose1Code_EPC121-16_2023_V1.0_SCT_Inst_C2P type from the above, it allows empty value, but the base type doesn't allow it. What the final restriction would be?

Edit:

xmllint cannot parse this XSD.

pain.001.001.09.xsd:882: element enumeration: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}enumeration': [facet 'minLength'] The value has a length of '0'; this underruns the allowed minimum length of '1'.
pain.001.001.09:882: element enumeration: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}enumeration': The value '' of the facet does not validate against the base type '{urn:iso:std:iso:20022:tech:xsd:pain.001.001.09}ExternalPurpose1Code'.
WXS schema pain.001.001.09.xsd failed to compile
1

There are 1 answers

0
Michael Kay On

The value space of a type derived by restriction must be a subset of the value space of its base type (that's why it's called a restricted type). If the base type doesn't allow an empty string, then the derived type can't allow an empty string either.