XML Export

Export data in DATEV XML format (“DATEV Online”).

Overview

The XML exporter generates:

  • One archive XML file (references all documents)
  • One XML file per invoice/credit memo
  • Optional XSD validation (archive + each document XML)

Configuration

Configure under: Stores > Configuration > MageB2B > DATEV Export Pro > XML Export Settings

Setting Description
Enable XML Export Shows XML settings in admin UI
XML Schema Version Version used for namespaces + XSD validation (e.g. v060)
Validate XML against XSD Validates archive + document files
XML Encoding Config option (current generator writes UTF-8)

XML Structure

The archive file has an <archive> root element and references each document file via <extension datafile="invoice_<id>.xml">....

Document files are nested based on the mapping keys (dot notation).

Field Mapping

XML mapping is configured as JSON:

  • JSON keys = XML field paths (dot notation creates nested elements)
  • JSON values = expressions evaluated against invoice.* / creditmemo.*

Example mapping (invoice):

{
  "header.invoiceNumber": "{{invoice.increment_id}}",
  "header.invoiceDate": "{{invoice.created_at}}",
  "amount.grossAmount": "{{invoice.grand_total}}",
  "amount.currencyCode": "{{invoice.order_currency_code}}",
  "customer.firstName": "{{invoice.billing_address.firstname}}",
  "customer.lastName": "{{invoice.billing_address.lastname}}"
}

Tip: Use Mapping Language to format values (dates, conditionals, functions).

Output Files

  • Archive: var/export/datev/DATEV_XML_<type>_<from>_<to>.xml
  • Documents: var/export/datev/invoice_<increment_id>.xml / creditmemo_<increment_id>.xml
  • ZIP (when “Download Documents” is enabled): var/export/datev/DATEV_XML_<type>_<from>_<to>.zip with:
    • document.xml (archive)
    • documents/*.xml
    • pdfs/*.pdf

Validation

If “Validate XML against XSD” is enabled, the exporter validates:

  • the archive XML file
  • each generated document XML file

Found an issue with this documentation? Let us know