validate_ubl_invoice
Validates UBL 2.1 invoice XML structure by checking required fields are present and non-empty.
Instructions
Validate a UBL 2.1 invoice XML string for structural correctness.
Performs structural validation by parsing the XML into an EN16931Invoice and checking that required core fields (invoice_number, invoice_date, seller, buyer, at least one line item) are present and non-empty.
Note: this tool does NOT validate against the normative UBL 2.1 XSD schema (the UBL XSD files are not bundled with this package). For full XSD validation use a dedicated UBL validator or the Peppol Validator tool.
On success returns {'valid': true, 'warnings': list[str]}. On failure returns {'valid': false, 'errors': list[str]}. On parse error returns {'valid': false, 'errors': ['XML parse error: ...']}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml_string | Yes | UBL 2.1 Invoice or CreditNote XML string to validate. Must contain a root element in the UBL Invoice-2 or CreditNote-2 namespace. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||