Function: parseScript()
parseScript(
raw,options?):ScriptMessage
Parse a raw NCPDP SCRIPT XML string into an immutable ScriptMessage.
Liberal on input (Postel's Law): recoverable anomalies become warnings with
stable codes and XPath context. Fatal only for unrecoverable structure:
empty input, non-XML / entity-bearing input, a non-<Message> root, or a
pre-XML legacy SCRIPT version.
Parameters
raw
string
The raw SCRIPT XML.
options?
Optional ParseScriptOptions.
Returns
The parsed ScriptMessage.
Throws
On unrecoverable structural problems.
Example
const msg = parseScript("<Message version='2017071'>…</Message>");
msg.asNewRx()?.medication?.description;