aprotiere
aprotiere

Reputation: 55

What to put in customizationID in UBL document and where to get this information

I am trying to generate Invoice UBL XML file according to this XSD file and this schematron. Once it is generated I am validating it here.

So, according to the schematron, I must have a CustomizationID in my XML file :

<assert id="BR-01" flag="fatal" test="normalize-space(cbc:CustomizationID) != ''">[BR-01]-An Invoice shall have a Specification identifier (BT-24).   </assert>

So I tried to find what kind of value was expected in CustomizationID, so I found here that the default value was urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0, so even thought it might not always be the right value to put in, it should at least be enough to validate the UBL document, am I wrong?

But if I put this value in my XML file and try to validate it, I have an error I don't understand.

Here is my XML file :

<?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>
    <cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0</cbc:CustomizationID>
    <cbc:InvoiceTypeCode>SalesInvoice</cbc:InvoiceTypeCode>
    <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>

When I try to validate my XML file, I have this error :

cvc-complex-type.2.4.a: Invalid content was found starting with element '{"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":CustomizationID}'. One of '{"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":IssueTime, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":DueDate, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":InvoiceTypeCode, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":Note, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":TaxPointDate, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":DocumentCurrencyCode, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":TaxCurrencyCode, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":PricingCurrencyCode, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":PaymentCurrencyCode, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":PaymentAlternativeCurrencyCode, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":AccountingCostCode, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":AccountingCost, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":LineCountNumeric, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":BuyerReference, "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2":InvoicePeriod, "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2":OrderReference, "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2":BillingReference, "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2":DespatchDocumentReference, "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2":ReceiptDocumentReference, "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2":StatementDocumentReference, "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2":OriginatorDocumentReference, "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2":ContractDocumentReference, "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2":AdditionalDocumentReference, "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2":ProjectReference, "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2":Signature, "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2":AccountingSupplierParty}' is expected.

I don't understand the error and how to fix it. First, how is it not a valid content if it is the default value, and second, why is it expecting any of these other fields instead? Any idea?

Upvotes: 0

Views: 1023

Answers (1)

Dijkgraaf
Dijkgraaf

Reputation: 11527

Basically it is telling you that is was not expecting CustomizationID at that point, but one if the other elements that it is listing (so they must all be optional except for the last one AccountingSupplierParty), so if you remove CustomizationID, then the next element will be InvoiceTypeCode and it will validate.

Image of Schema

CustomizationID is an optional element <xsd:element minOccurs="0" maxOccurs="1" ref="cbc:CustomizationID">, and the proceeding two elements UBLExtensions and UBLVersionID are also optional, and as you don't have those, CustomizationID should be first, before ID (which is mandatory <xsd:element minOccurs="1" maxOccurs="1" ref="cbc:ID">.

So it should look more like this

<?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:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0</cbc:CustomizationID>
    <cbc:ID>A00095678</cbc:ID>
    <cbc:IssueDate>2005-06-21</cbc:IssueDate>
    <cbc:InvoiceTypeCode>SalesInvoice</cbc:InvoiceTypeCode>
    <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>

That still fails in Schematron, but not about that field.

Upvotes: 0

Related Questions