parse_fattura_xml
Parse a FatturaPA XML string into a structured Python dictionary to inspect or process electronic invoices from counterparties or verify generated invoices.
Instructions
Parse a FatturaPA XML string into a structured Python dict.
Use this to inspect or process invoices received from counterparties, or to verify the output of generate_fattura_xml(). Accepts both FPR12 (B2B) and FPA12 (PA) formats. The result can be passed directly to export_to_json().
Extracts: versione, transmission data, seller/buyer identity and address, document type/date/number/causale, all DettaglioLinee, DatiRiepilogo, and DatiPagamento if present. Fields not found in the XML are returned as null.
On success returns {'versione': str, 'header': {...}, 'body': {...}}. On XML parse error returns {'error': 'XML parse error: '}. On missing lxml returns {'error': 'lxml is not installed...'}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml_string | Yes | FatturaPA XML string to parse. Accepts both single-invoice (FPR12) and PA-addressed (FPA12) formats. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||