Documentation / @facturometro/einvoice / parseCreditNote
Function: parseCreditNote() ​
parseCreditNote(
xml):ParseResult<UncheckedCreditNote>
Defined in: packages/parser/src/parse.ts:196
Parses a UBL credit note.
Parameters ​
xml ​
string
The document, as text.
Returns ​
ParseResult<UncheckedCreditNote>
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 an invoice.
Example ​
ts
import { parseCreditNote } from '@facturometro/parser';
const { diagnostics, document } = parseCreditNote(xml);
document.creditNoteLine?.length; // number | undefined