Runtime verified Test scripts included

Builds a rowset from the XML nodes an XPath expression selects; each row carries the node value, its XML, and its attributes.

Syntax

{{buildRowSetFromXml xml xpath ...options}}

Returns array.

Parameters

Name Type Required Description
xml string Yes The XML to read.
xpath string Yes XPath expression picking the nodes.
options any Yes, repeatable Required named argument returnEmptyOnError: true yields an empty rowset when parsing or the XPath fails, false raises an error.

Example

Tested in a Marketing Cloud Next email on 2026-11-22:

  • {{length (buildRowSetFromXml "<r><i>1</i><i>2</i></r>" "/r/i" returnEmptyOnError=true)}} renders 2, as documented.
  • {{length (buildRowSetFromXml "not xml" "/r" returnEmptyOnError=true)}} renders 0, as documented.
Show Next test script
<!-- Marketing Cloud Next test script for the buildRowSetFromXml helper. Paste it into the HTML component of a
     Next email and open the preview. Each line prints the result Next gave when the call
     was rendered on its own (expect) next to the result of this run (got).
     Assembled from single-call test emails (dates on the page); it has not been
     run as one email. Calls that make Next fail are listed separately. -->
<p>c1 expect=[2] got=[{{length (buildRowSetFromXml "<r><i>1</i><i>2</i></r>" "/r/i" returnEmptyOnError=true)}}]</p>
<p>c2 expect=[0] got=[{{length (buildRowSetFromXml "not xml" "/r" returnEmptyOnError=true)}}]</p>

Marketing Cloud Next

Works as documented

Every tested call rendered the documented result. Tested 2026-11-22 by rendering in a Marketing Cloud Next email.

See also