Documentation / @facturometro/einvoice / parseInvoice
Function: parseInvoice() ​
parseInvoice(
xml):ParseResult<UncheckedInvoice>
Defined in: packages/parser/src/parse.ts:175
Parses a UBL invoice.
Parameters ​
xml ​
string
The document, as text.
Returns ​
The model, the structural diagnostics and whether any of them is fatal.
Throws ​
When the document is not well-formed XML.
Throws ​
When the document element is neither a UBL Invoice nor a UBL CreditNote.
Throws ​
When the document is a credit note.
Example ​
ts
import { parseInvoice } from '@facturometro/parser';
const { diagnostics, document } = parseInvoice(xml);
document.id; // string | undefined