Schema validation failed; XML does not comply with UBL 2.1 standards in line with ZATCA specifications

Hello,

I’am processing invoices using zatca odoo and i’am receiving the following error:
{"validationResults":{"infoMessages":[],"warningMessages":[{"type":"WARNING","code":"BR-S-08","category":"EN_16931","message":"For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is “Standard Rated”, the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are “Standard Rate“. and the VAT rates (BT-152,BT-96,BT-103) equal the VAT category rate (BT-119)","status":"WARNING"},{"type":"WARNING","code":"BR-CO-10","category":"EN_16931","message":"Sum of Invoice line net amount (BT-106) ","status":"WARNING"},{"type":"WARNING","code":"BR-CO-13","category":"EN_16931","message":"Invoice total amount without VAT (BT-109) = S Invoice line net amount (BT-131) - Sum of allowances on document level (BT-107) + Sum of charges on document level (BT-108).","status":"WARNING"}],"errorMessages":[{"type":"ERROR","code":"XSD_ZATCA_INVALID","category":"XSD validation","message":"Schema validation failed; XML does not comply with UBL 2.1 standards in line with ZATCA specifications. ERROR: org.xml.sax.SAXParseException; lineNumber: 252; columnNumber: 11; cvc-complex-type.2.4.b: The content of element 'Invoice' is not complete. One of '{\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2\":InvoiceLine}' is expected.","status":"ERROR"},{"type":"ERROR","code":"BR-16","category":"EN_16931","message":"An Invoice shall have at least one Invoice line (BG-25)","status":"ERROR"}],"status":"ERROR"},"reportingStatus":"NOT_REPORTED"}
Full image:

XML Content:

 <cac:LegalMonetaryTotal>
    <cbc:LineExtensionAmount currencyID="SAR">38.87</cbc:LineExtensionAmount>
    <cbc:TaxExclusiveAmount currencyID="SAR">38.87</cbc:TaxExclusiveAmount>
    <cbc:TaxInclusiveAmount currencyID="SAR">44.70</cbc:TaxInclusiveAmount>
    <cbc:AllowanceTotalAmount currencyID="SAR">0.00</cbc:AllowanceTotalAmount>
    <cbc:PrepaidAmount currencyID="SAR">0.00</cbc:PrepaidAmount>
    <cbc:PayableAmount currencyID="SAR">44.70</cbc:PayableAmount>
  </cac:LegalMonetaryTotal>

Your help is so much appreciated, thank you!

Hi @Abderrahmen ,

You need to follow XML Standards also, you can refer to the Data Dictionary

1 Like

Hello,

Thank you, this solved my problem.
Actually the discount product had a -1 quantity which translate to 0 product in XML. XML was missing ‘InvoiceLine’. an adjustment to the quantity solved the problem.

Thank you.