0

Here is my XML test code :

<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:ccts="urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2" xmlns:stat="urn:oasis:names:specification:ubl:schema:xsd:DocumentStatusCode-1.0" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:udt="urn:un:unece:uncefact:data:draft:UnqualifiedDataTypesSchemaModule:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
    <cbc:ID>A00095678</cbc:ID>
    <cbc:IssueDate>2005-06-21</cbc:IssueDate>
    <cac:AccountingSupplierParty>
    </cac:AccountingSupplierParty>
    <cac:AccountingCustomerParty>
    </cac:AccountingCustomerParty>
    <cac:LegalMonetaryTotal>
        <cbc:PayableAmount currencyID="GBP">107.50</cbc:PayableAmount>
    </cac:LegalMonetaryTotal>
    <cac:InvoiceLine>
        <cbc:ID>A</cbc:ID>
        <cbc:LineExtensionAmount currencyID="GBP">100.00</cbc:LineExtensionAmount>
        <cac:Item>
        </cac:Item>
    </cac:InvoiceLine>
</Invoice>

I put the only elements that were required due to having minOccurs="1" in the UBL.xsd file.

When I try to validate my XML on this site

[BR-01]-An Invoice shall have a Specification identifier (BT-24).
[BR-04]-An Invoice shall have an Invoice type code (BT-3).
[BR-05]-An Invoice shall have an Invoice currency code (BT-5).
[BR-06]-An Invoice shall contain the Seller name (BT-27).
[BR-07]-An Invoice shall contain the Buyer name (BT-44).
[BR-08]-An Invoice shall contain the Seller postal address.
[BR-10]-An Invoice shall contain the Buyer postal address (BG-8).
[BR-CO-18]-An Invoice shall at least have one VAT breakdown group (BG-23).

I understand what the error mean, my question is more : What is the UBL.xsd file is saying that these elements are mandatory? I will have to generate files regarding other .xsd files and I'd like to understand what elements are mandatory.

aprotiere
  • 35
  • 4
  • While asking an XSD question you need to provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example): (1) Well-formed input XML. (2) Your logic, and XSD that tried to implement it. (3) XSD processor and its conformance with the XSD standards: 1.0, or 1.1. – Yitzhak Khabinsky Aug 08 '23 at 21:10
  • **"What is the UBL.xsd file is saying that these elements are mandatory?"** This does not make sense. You should clarify or elaborate further what you mean. – mamift Aug 09 '23 at 00:44
  • I don't know anything about UBL, but it is not unusual for a specification to impose semantic rules alongside the structural rules in the XSD schema. Sometimes there is both an XSD schema and a set of semantic rules expressed in Schematron. – Michael Kay Aug 09 '23 at 06:19
  • If it has minoccurs="0" then that element is optional according to the xsd. As per Martin's answer, those validation messages are not from the schema. – Dijkgraaf Aug 13 '23 at 02:04

1 Answers1

1

I think these errors are from Schematron validation, see e.g. https://github.com/ConnectingEurope/eInvoicing-EN16931/blob/validation-1.3.10/ubl/schematron/preprocessed/EN16931-UBL-validation-preprocessed.sch#L79.

Martin Honnen
  • 160,499
  • 6
  • 90
  • 110