Solved: XML does not comply with UBL 2.1 standards in line with ZATCA specifications

A Chilkat customer is getting this error when trying to validate the signed invoice on the ZATCA XML online validator (Sandbox)

category : XSD_SCHEMA_ERROR
code :SAXParseException
message : Schema validation failed; XML does not comply with UBL 2.1 standards in line with ZATCA specifications

The solution is to examine the XML using the UBL 2.1 validation tool at https://joinup.ec.europa.eu/collection/interoperability-test-bed-repository/solution/ubl-21-e-invoice-validation-service/about

and then click through to the web interface at https://www.itb.ec.europa.eu/invoice/upload

Upload the XML to see the specific UBL 2.1 errors. For the problem we solved, the issue was the ordering of XML elements in the cac:PostalAddress. The order needed to be like this:

      <cac:PostalAddress>
        <cbc:StreetName>...</cbc:StreetName>
        <cbc:BuildingNumber>...</cbc:BuildingNumber>
        <cbc:PlotIdentification>...</cbc:PlotIdentification>
        <cbc:CitySubdivisionName>ِ...</cbc:CitySubdivisionName>
        <cbc:CityName>...</cbc:CityName>
        <cbc:PostalZone>...</cbc:PostalZone>
        <cbc:CountrySubentity>...</cbc:CountrySubentity>
        <cac:Country>
          <cbc:IdentificationCode>SA</cbc:IdentificationCode>
        </cac:Country>
      </cac:PostalAddress>
Tags :