Skip to main content
Version: v0.0.3

Function: parseEd()

parseEd(el, ctx): ED | undefined

Parse an ED element into a typed ED. Returns undefined when the element is absent. Captures inline content verbatim (base64 is not decoded) and resolves a child <reference>'s @value. Never throws.

A @nullFlavor declared beside inline content or a <reference> emits CONTRADICTORY_NULL_FLAVOR; a @mediaType or @representation alone describes a null value rather than contradicting it and stays silent. Content and reference are kept verbatim (see parsePq).

Parameters

el

any

ctx

ParseCtx

Returns

ED | undefined

Example

import { parseEd } from "@cosyte/ccda";
const ed = parseEd(el, { emit: () => {} });
console.log(ed?.reference ?? ed?.value);