xmlxsdubl

How to know what element is mandatory if it has miniOccurs="0" in UBL


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.


Solution

  • 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.