m2m.maE-invoicing
E-invoicing

XML and UBL formats: e-invoice interoperability explained

XML, UBL and interoperability: understand structured invoices, why they matter for e-invoicing reform in Morocco and how to prepare, without the jargon.

by the m2m.ma team · Published on · 4 min read

XML and UBL formats: e-invoice interoperability explained

Why talk about formats?

When electronic invoicing comes up, the question of format follows quickly, often accompanied by intimidating acronyms: XML, UBL, EDI. Behind this vocabulary lies a simple idea. For software to automatically read an invoice issued by other software, both must speak the same language, that is, store the same information in the same places, under the same names.

A PDF cannot do that: it presents information for the human eye, without telling the machine where the VAT amount or the customer's ICE is. A structured file, on the other hand, labels every piece of data. That is what makes automatic data entry at the customer's end, automated checks and, in the future, transmission to the administration possible.

XML, the basic language

XML is a very widespread data description language. An XML file consists of tags that enclose each piece of information: one tag for the invoice number, one for the date, one for the seller's identifier and so on. It is readable by a person, even if not very pleasant to read, and above all perfectly usable by a program.

But XML is only a grammar. Two programs can produce XML without understanding each other, if one calls "NumeroFacture" what the other calls "InvoiceID". So, in addition, you need a common vocabulary that fixes the name and meaning of each field. That is the role of electronic invoice standards.

UBL and international standards

UBL, for Universal Business Language, is an international standard managed by the OASIS organization. It defines, in XML, the structure of many business documents, including the invoice and the credit note. It is used in several countries and exchange networks, particularly in Europe, where the EN 16931 standard sets a common semantic model that UBL can express.

Other formats exist, such as UN/CEFACT CII or specific national formats. Each administration that rolls out electronic invoicing chooses the accepted format or formats and the transmission rules. For Morocco, it is up to the DGI to specify these technical choices: follow the official announcements on tax.gov.ma rather than speculation.

  • XML: the grammar for describing data
  • UBL: a standard vocabulary for business documents
  • EN 16931: European semantic model of the invoice
  • National format: set by each administration

Interoperability in practice

Interoperability refers to the ability of different systems to exchange data without re-keying. For an SME, it means that an invoice issued in its software can be loaded directly into the software of its customer, its accountant or the administration. No more copying amounts, scanning documents or checking line by line.

Take a fictitious example: a wholesaler that receives 300 supplier invoices a month and spends two minutes entering each one devotes about ten hours to it. If these invoices arrive in a structured format it can read, data entry becomes a simple check. The gain depends on the volume and on how many of its suppliers adopt the format, but it is real.

How to prepare without being an IT specialist

The good news is that an SME manager does not have to handle XML. The format is the software's business. Your role is to make sure your data is clean and complete, because a structured file does not tolerate approximation: a missing ICE, an inconsistent VAT rate or an incomplete address will block the exchange where a PDF would have gone unnoticed.

Also choose an online tool, maintained by a vendor that follows changes in Moroccan regulations, rather than a homemade template. When the DGI specifies its requirements, it is the vendor that will adapt the software. On your side, preparation mainly consists of making your customer records, your catalog and your numbering reliable.

  • Complete customer records with a verified ICE
  • One VAT rate per item
  • Continuous numbering
  • Online software maintained by its vendor

Structured data starting today with m2m.ma

In m2m.ma, every invoice is built from structured data: customer and checked ICE, items, VAT rates, a number assigned without gaps. The same data automatically feeds the accounting entries and the prepared VAT, and you can import invoices from other software. It is this clean foundation that lets you approach the changes announced by the DGI with peace of mind.

To see how your invoices are structured in the tool, open an account on my.m2m.ma and take advantage of the 15-day free trial, with no commitment. Import part of your history, issue a few invoices and check with your accountant that the data carried over is complete and consistent. It is a good exercise for spotting, right now, the customer records or items that will need completing before any obligation.

Frequently asked questions

Which e-invoice format will Morocco adopt?

The choice of format and transmission procedures belongs to the DGI. As long as no official specification has been published for your situation, be wary of categorical claims. Consult tax.gov.ma and favor software whose vendor follows these developments.

Do I need to learn XML to invoice electronically?

No. XML is produced and read by software, not by users. Your job is to enter accurate and complete information into your invoicing tool. It takes care of structuring it in the expected format.

What is a PDF with an embedded XML file?

Some so-called hybrid formats combine a human-readable PDF and a machine-readable XML file in a single document. They are used in several countries. Whether they will be accepted in Morocco depends on the DGI's technical choices.

Share this article

Put it into practice with m2m.ma

E-invoicing, accounting and business management services for Moroccan companies. 15-day free trial, no credit card.