Skip to content

Documentation / @facturometro/parser / parseCreditNote

Function: parseCreditNote() ​

parseCreditNote(xml): ParseResult<UncheckedCreditNote>

Defined in: 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

MIT licensed. Specification artefacts belong to OpenPEPPOL, CEN and OASIS.