ValidateInvoiceBusinessRulesWithTools
Invoices, Compliance
Requires the Small Business edition — in Delphi, C++Builder and Lazarus code create the library as TPDFlibSmallBusiness (unit PDFlibSmallBusiness) or TPDFlibEnterprise; the Small Business and Enterprise DLL and ActiveX builds provide it unchanged; the Single edition keeps the method, which returns 0, an empty string or False and sets LastErrorCode to 901 (PDFLIB_ERROR_SMALLBUSINESS_REQUIRED)
Description
Run XML schema and Schematron validation for an embedded invoice
Syntax
Delphi
Function TPDFlib.ValidateInvoiceBusinessRulesWithTools(Const EmbeddedFileName, Standard, RulesVersion, RulesProfile, SchemaFile, SchematronStylesheetFile, XMLLintExecutable, JavaExecutable, SaxonClassPath: WideString;
TimeoutMS: Integer): WideString; Virtual;DLL
const wchar_t* DLValidateInvoiceBusinessRulesWithTools(int InstanceID, const wchar_t* EmbeddedFileName, const wchar_t* Standard, const wchar_t* RulesVersion, const wchar_t* RulesProfile, const wchar_t* SchemaFile, const wchar_t* SchematronStylesheetFile, const wchar_t* XMLLintExecutable, const wchar_t* JavaExecutable, const wchar_t* SaxonClassPath, int TimeoutMS);
const char* DLValidateInvoiceBusinessRulesWithToolsA(int InstanceID, const char* EmbeddedFileName, const char* Standard, const char* RulesVersion, const char* RulesProfile, const char* SchemaFile, const char* SchematronStylesheetFile, const char* XMLLintExecutable, const char* JavaExecutable, const char* SaxonClassPath, int TimeoutMS);ActiveX
Function PDFlib::ValidateInvoiceBusinessRulesWithTools(EmbeddedFileName As String, Standard As String, RulesVersion As String, RulesProfile As String, SchemaFile As String, SchematronStylesheetFile As String, XMLLintExecutable As String, JavaExecutable As String, SaxonClassPath As String, TimeoutMS As Long) As StringParameters
| EmbeddedFileName | Name of the embedded invoice to validate; an empty value selects the detected Factur-X or ZUGFeRD attachment |
|---|---|
| Standard | Invoice standard the rules target, such as EN 16931, Factur-X or ZUGFeRD |
| RulesVersion | Release identifier of the rule package |
| RulesProfile | Invoice profile the rules expect, such as MINIMUM, BASIC WL, BASIC, EN 16931, EXTENDED or XRECHNUNG |
| SchemaFile | XSD package read by the schema stage; documents it imports must resolve beside it |
| SchematronStylesheetFile | Compiled .xsl or .xslt stylesheet; an uncompiled .sch file is rejected |
| XMLLintExecutable | Path to the xmllint executable; an empty value runs the built-in XML Schema validator, which reports engine BuiltIn XSD |
| JavaExecutable | Path to the Java executable used for the SaxonJ transform |
| SaxonClassPath | Semicolon-separated class path containing SaxonJ and its dependencies |
| TimeoutMS | Timeout applied to each external tool in milliseconds; zero or a negative value selects 30000 ms |
Return values
Returns the validation report as JSON with the selected standard, version and profile, a complete and valid verdict, and separate schema and schematron stage objects. An empty string is returned when the report cannot be produced. The Single edition returns an empty string and sets LastErrorCode to 901 (PDFLIB_ERROR_SMALLBUSINESS_REQUIRED).
Remarks
Returns JSON for the selected embedded XML using both a versioned XSD package and a compiled Schematron XSLT stylesheet; this convenience method always requires both stages
Leave XMLLintExecutable empty to run the schema stage with the built-in XML Schema validator, which reads SchemaFile and the documents it imports and reports engine BuiltIn XSD on every platform
Pass executable file paths for xmllint and Java, and a semicolon-separated SaxonClassPath containing SaxonJ and its dependencies; use compiled .xsl or .xslt, rather than an uncompiled .sch file
RulesVersion identifies the rule-package release and RulesProfile identifies the intended invoice profile; select matching rules explicitly because schema and generic EN16931 rules do not automatically include every national or industry profile
Both tools run without a shell or a visible window, with DTD processing disabled, a bounded output size and the requested timeout; TimeoutMS<=0 selects 30000 ms
JSON contains standard, version, profile, complete, valid, and separate schema and schematron stages; stages include status, completion, engine, execution counts, diagnostics, and issues with rule ID, field path, severity, line, and message
Stage status is passed, failed, error, unavailable, or not_checked; a failed rule may have complete=true, while missing dependencies, timeouts, output limits, invalid SVRL, and unexecuted rules cannot produce a valid result
The built-in tool adapter requires Windows; portable applications can supply their own IPDFInvoiceValidationProvider through the typed API
PDF container checks and invoice business validation are separate operations; call ValidateFacturXInvoice as well when the PDF/A-3 and hybrid attachment conventions must be checked
DLL results are instance-owned and must be copied before another string-result call; the A result contains UTF-8 JSON and A input strings use the instance ANSI setting
See also
ValidateFacturXInvoice, ValidateInvoiceBusinessRules, ValidateInvoiceBusinessRulesWithPackage, ExtractFacturXXMLToString