HCL Domino · E-Invoicing · EN 16931 · API-Engine
E-Invoice Processing in HCL Domino – ZUGFeRD, Factur-X & XRechnung
Electronic invoices are increasingly exchanged as structured data rather than documents intended only for human reading. The SL Net-Solutions Domino API-Engine can extract invoice data from hybrid PDF/XML documents and process XML invoices within existing HCL Domino workflows.
A new example in the API-Engine V12.12 Evaluation Package demonstrates the process using a ZUGFeRD/Factur-X invoice. The PDF is read into a BINBUFFER, the embedded invoice XML is extracted in memory, and XML and XPath functions select the relevant invoice fields. The resulting values can then be stored in a Domino document.
PDF → XML → XPath → Domino. The embedded XML does not need to be written to a temporary file or passed to an external conversion service. When an invoice is already supplied as XML, as is typical for XRechnung, processing begins directly at the XML stage.
European e-invoicing standards
One business data model, different document formats
ZUGFeRD and XRechnung are associated with Germany, but the underlying challenge is international: applications need to read, interpret and integrate machine-readable invoice data. EN 16931 provides a European semantic data model for electronic invoices. The physical packaging, XML syntax and applicable business rules depend on the selected format and profile.
Hybrid PDF with embedded XML
ZUGFeRD and the French-named Factur-X are technically aligned hybrid invoice formats. A readable PDF/A-3 document carries structured XML invoice data using UN/CEFACT Cross Industry Invoice (CII). The applicable validation requirements depend on the profile.
Structured XML invoice
XRechnung specifies German requirements based on EN 16931. Invoices can use UBL or CII syntax. They are generally exchanged as XML documents and do not require a PDF container.
European semantic model
EN 16931 defines the business information represented by an electronic invoice. XML structures, namespace mappings and validation rules must still be handled for each supported syntax, profile and national implementation.
Scope of this example: The following demonstration works with CII XML embedded in a ZUGFeRD/Factur-X PDF. An XRechnung in CII syntax can be processed using the same basic XML approach. UBL invoices need different element paths, namespace mappings and data extraction rules.
Processing pipeline
From an invoice PDF to Domino items
The processing pipeline runs within a server-side API-Engine script. The PDF BINBUFFER may originate from a Domino attachment, a file or another supported source; the extraction logic does not depend on a separate standalone invoice application.
PDF BINBUFFER
as BINBUFFER
Namespaces · values
Currency · amounts
For a pure XML invoice, the PDF extraction stage is skipped. Once the XML has been parsed, the subsequent processing is conceptually similar.
Practical example
A small set of invoice fields, a transparent workflow
The evaluation example uses a limited set of test invoices. It is not intended to reproduce an accounting system or a comprehensive invoice processing platform. Its purpose is to demonstrate how structured invoice data can be transferred into a Domino NSF application.
InvoiceNumberThe invoice identifier contained in the CII document.
InvoiceDateRawThe date as represented in the XML, prior to optional conversion.
SellerThe name of the business issuing the invoice.
BuyerThe customer identified in the invoice document.
CurrencyThe invoice currency code, for example EUR.
GrandTotalThe total invoice amount from the monetary summation.
DueAmountThe amount remaining payable according to the invoice data.
The example intentionally focuses on selected invoice header fields. However, all information contained in the invoice XML can be extracted and processed, including individual invoice line items, product numbers, quantities, unit prices, tax details, payment terms, bank account information, and references to purchase orders or delivery notes.
More complex and repeating XML structures can also be processed using the API-Engine’s XML functions and XPath expressions. The information extracted and transferred to Domino therefore depends on the requirements of the application rather than on a limitation of the API-Engine.
CII XML example
What the structured invoice data looks like
The invoice information is read from structured XML elements, not extracted by recognizing text on the visible PDF page. The following abbreviated CII fragment contains the elements used in our example:
<rsm:CrossIndustryInvoice
xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100">
<rsm:ExchangedDocument>
<ram:ID>471102</ram:ID>
<ram:IssueDateTime>
<udt:DateTimeString format="102">20241115</udt:DateTimeString>
</ram:IssueDateTime>
</rsm:ExchangedDocument>
<rsm:SupplyChainTradeTransaction>
<ram:ApplicableHeaderTradeAgreement>
<ram:SellerTradeParty>
<ram:Name>Example GmbH</ram:Name>
</ram:SellerTradeParty>
<ram:BuyerTradeParty>
<ram:Name>Sample Customer Ltd.</ram:Name>
</ram:BuyerTradeParty>
</ram:ApplicableHeaderTradeAgreement>
<ram:ApplicableHeaderTradeSettlement>
<ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>
<ram:SpecifiedTradeSettlementHeaderMonetarySummation>
<ram:GrandTotalAmount>529.87</ram:GrandTotalAmount>
<ram:DuePayableAmount>529.87</ram:DuePayableAmount>
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
</ram:ApplicableHeaderTradeSettlement>
</rsm:SupplyChainTradeTransaction>
</rsm:CrossIndustryInvoice>Abbreviated, illustrative CII XML with sample values. This is not a complete or validatable ZUGFeRD, Factur-X or XRechnung invoice.
Namespace handling matters: Elements such as
ram:ID and ram:GrandTotalAmount belong to
defined XML namespaces. XPath queries need the correct namespace
mappings rather than relying on unqualified element names.
Technical workflow
What the sample script actually does
The script processes a small collection of Domino test documents.
In the example, the PDF originates from a Domino attachment. Other sources, such as files or REST interfaces, are possible.
@PDFExtractInvoiceXML reads the embedded invoice XML from the PDF BINBUFFER and returns it as another BINBUFFER.
@XMLParse creates an XML document handle. Processing continues from its root node.
@XMLSelectSingleNode selects elements using namespace-aware expressions; @XMLGetContent reads their contents.
The extracted values are written to Domino items. Temporary buffers and XML handles are released after processing.
API-Engine XML functions
From an XML handle to an invoice field
After extraction, the API-Engine treats the invoice as an ordinary XML document. The following function sequence illustrates the main steps needed to read an invoice number:
PDF BINBUFFER
|
+-- @PDFExtractInvoiceXML(PDFBuffer)
|
v
Invoice XML (BINBUFFER)
|
+-- @XMLParse(InvoiceXML; 1)
|
+-- @XMLGetRoot(Doc)
|
+-- @XMLSelectSingleNode(
Root; XPath; Prefixes; Namespaces)
|
+-- @XMLGetContent(Node)
|
+-- Write Domino item
Cleanup: @XMLRelease(Doc), @DestroyBuffer(...)Schematic sequence, not an executable API-Engine script. The complete example, including database access, function parameters and error handling, is supplied in the Evaluation Package.
For example, the invoice number can be found using this CII XPath:
/rsm:CrossIndustryInvoice
/rsm:ExchangedDocument
/ram:IDLine breaks are added for readability; the actual XPath is written on one line.
Monetary values are located elsewhere in the document, under
ram:ApplicableHeaderTradeSettlement and
ram:SpecifiedTradeSettlementHeaderMonetarySummation.
Prefixes such as rsm, ram and udt
must be associated with their namespace URIs when querying the XML.
Explore the Complete API-Engine Example Script
Want to see how these functions are used in practice? The complete example script demonstrates how the API-Engine reads PDF attachments from Domino documents, extracts embedded ZUGFeRD / Factur-X invoice XML, processes invoice data using XML functions and XPath expressions, and stores the extracted information back into Domino.
The full source code is available online with syntax highlighting and can be copied directly for further examination.
Result
Structured invoice data in a Domino document
The XML fragment above produces the following illustrative field values. Once stored as Domino items, the data can be used in views, workflows, comparisons or subsequent integration steps.
| Domino item | Sample value |
|---|---|
InvoiceNumber | 471102 |
InvoiceDateRaw | 20241115 |
Seller | Example GmbH |
Buyer | Sample Customer Ltd. |
Currency | EUR |
GrandTotal | 529.87 |
DueAmount | 529.87 |
Illustrative output from the abbreviated XML example above.
Important distinction
Extracting invoice data is not the same as validating an invoice
This example focuses on accessing and interpreting structured invoice data. Establishing whether an invoice complies with its declared profile, EN 16931 and applicable business rules is a separate task.
The sample script is not a complete e-invoice validator. Successfully reading a few XML elements does not prove that an invoice is valid. Formal compliance checks require the appropriate schemas and business-rule validation, such as the official KoSIT XRechnung validation artifacts for the relevant German format.
Production workflows may additionally require support for multiple invoice profiles, CII and UBL mapping, error handling, date and amount checks, duplicate detection, audit logging and integration with accounting or ERP applications.
Domino integration
Why this approach is relevant to existing Domino applications
Structured invoice data can become part of an existing Domino workflow rather than requiring a separate standalone processing application. The demonstration focuses on combining document access, XML extraction and NSF data processing in a single server-side workflow.
In-memory XML extraction
Embedded invoice XML can be extracted from a PDF buffer and processed as an XML buffer without first creating a temporary XML file.
Targeted field extraction
XML document handles and namespace-aware XPath queries allow direct access to selected invoice fields.
Results in the same workflow
Extracted values can be written directly into NSF documents and reused by established business processes.
Technical perspective
LotusScript, Java or the API-Engine?
Processing structured invoice XML is not exclusive to the API-Engine. Domino developers already have established XML processing options in both LotusScript and Java. The practical differences concern how PDF attachments, XML parsing and subsequent Domino processing are brought together and maintained.
XML using Domino’s native classes
NotesDOMParser, NotesSAXParser and
NotesStream can process XML directly in LotusScript.
For XML-only invoices, this may already be sufficient. Extracting
embedded invoice XML from a ZUGFeRD/Factur-X PDF requires an
additional suitable mechanism.
XML, XPath and PDF libraries
Java offers DOM, SAX and XPath for structured XML processing. Libraries such as Apache PDFBox can also extract embedded files from PDF documents. Their use involves selecting suitable versions and integrating and maintaining them in the Domino runtime.
One Engine script for the full pipeline
In this example, @PDFExtractInvoiceXML extracts the
embedded XML from the PDF BINBUFFER. XML and XPath functions then
read the invoice fields, and the values are passed directly into
Domino processing within the same script.
The point is not that LotusScript or Java cannot solve this task. The API-Engine brings PDF extraction, XML querying and Domino processing together in a consistent scripting environment. If an invoice is already provided as XML, the PDF extraction step is unnecessary regardless of which technology is used.
Evaluation Package
Try the e-invoice example
The current API-Engine V12.12 Evaluation Package includes the example script and test data for extracting and processing structured e-invoice information in HCL Domino.
ZUGFeRD / XRechnung – Example Script
The sample demonstrates reading an invoice PDF attachment,
extracting the embedded CII XML with
@PDFExtractInvoiceXML, evaluating invoice fields with
XML/XPath and storing selected data as Domino items.
The examples are intended for a controlled test or development environment and do not constitute a complete production-ready invoice processing system.
Conclusion
E-invoice XML as another data source for Domino
Whether the invoice arrives as a hybrid Factur-X/ZUGFeRD PDF or as an XML-only XRechnung document, its structured information can be made available to existing business applications.
The API-Engine connects document input, namespace-aware XML parsing and Domino data processing: from a PDF BINBUFFER through XPath selection to the items stored in an NSF database.
This example intentionally focuses on a few invoice fields. The approach can be extended with additional mappings, validation steps, database lookups and interfaces to external systems. The integration pattern is relevant beyond any single national e-invoicing format.
Technical references
Standards and additional resources
FeRD – ZUGFeRD / Factur-X · FeRD – Specifications and downloads · KoSIT – XRechnung Validator Configuration · HCL – XML with LotusScript
