Skip to content

Rule.io SDK


Rule.io SDK / rcml/src / rcmlToXml

Function: rcmlToXml()

rcmlToXml(doc, options?): string

Defined in: rcml/src/email/rcml-to-xml.ts:46

Serialize an RcmlDocument JSON AST to an RCML XML string.

Useful for exporting a template to a human-readable form (e.g. for debugging or sharing) and for JSON → XML → JSON round-trips. Combine with xmlToRcml for the reverse direction.

Parameters

doc

RcmlDocument

The document (or any sub-tree node) to serialize.

options?

RcmlToXmlOptions = {}

Formatting options; see RcmlToXmlOptions.

Returns

string

An XML string representing the document.

Example

ts
rcmlToXml({ tagName: 'rcml', children: [...] })
// => '<rcml>\n  <rc-head></rc-head>\n  ...'