E-Invoice Business-Rule Validation

HPDFEInvoiceValidator combines Factur-X or ZUGFeRD container validation with the complete business-rule set selected by the embedded invoice profile

Complete reviewed rule execution

The library ships matching `.sch` and `_codedb.xml` resources for MINIMUM, BASIC WL, BASIC, EN 16931, and EXTENDED

The XE2 and later engine executes the complete reviewed XPath 2 surface through secure MSXML parsing, deterministic XPath 1 equivalents, and direct evaluation for quantifiers, FLWOR sums, casts, sequence comparisons, external code lists, date patterns, and boolean indicator values

The EN 16931 profile contains 618 checks and every check is processed during each validation run

Combined validation

var
  Report: THPDFEInvoiceValidationReport;
begin
  if not HPDFValidateEInvoice(PDF,
    'Lib\resources\Schematron', Report) then
    LogValidationFailure(Report);
end;

HPDFValidateEInvoice first calls THotPDF.ValidateFacturXInvoice, extracts and identifies the invoice XML, loads the profile-specific Schematron resources, and executes the business rules

A detected hybrid invoice fails closed when XML extraction, profile detection, rule loading, code-database loading, or expression evaluation cannot complete

The function returns true only when the container is valid, business rules were evaluated, and no error or warning finding remains

Engine API

Engine := HPDFCreateSchematronEngine;
if not Engine.Load(SchematronPath, ErrorText) then
  raise Exception.Create(ErrorText);

Findings := Engine.Validate(XMLBytes);
Summary := Engine.LastSummary;

THPDFSchematronSummary reports Profile, TotalRules, Evaluated, Skipped, EvaluationErrors, Violations, EngineAvailable, and EngineNote

Skipped remains zero in the XE2 and later engine and is reserved for the Delphi 7 stub or legacy result data

Malformed or unsupported expressions produce explicit error-severity findings, increment EvaluationErrors, and never disappear as successful checks

Stable diagnostics and limits

Toolchain availability

Delphi XE2 and later use the built-in MSXML compatibility engine

Delphi 7 retains the shared interfaces and result types but returns an unavailable-engine diagnostic

Related APIs