---
schema_version: "1"
id: bd0423bb4cf521c115704c64a70c6742add1ee343d3513ce9176bded07c5009d
title: "Handlebars Helper Function: buildRowSetFromXml"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/handlebars/reference/content/mcn-handlebars-reference-content-buildrowsetfromxml.md
canonical_url: https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-content-references/mcn-handlebars-reference-content-buildrowsetfromxml.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5f6a6eecff78aea42d57ac5a223b14d8fd7fcf788bec03b25de118fb84ffd9e0
products:
  - Handlebars for Marketing Cloud Next
  - Marketing Cloud
---
# Handlebars Helper Function: buildRowSetFromXml

Loads XML data into a rowset by using an XPath expression.

## Availability

This helper is available in the Winter ’27 release of Marketing Cloud Next.

## Syntax

```handlebars
{{buildRowSetFromXml xmlData xpathExpression returnEmptyOnError=true|false}}
```

## Parameters

| Parameter            | Type    | Description                                                                                                                                         |
| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `xmlData`            | String  | Required. The XML data to parse.                                                                                                                    |
| `xpathExpression`    | String  | Required. The XPath expression that selects nodes from `xmlData`.                                                                                   |
| `returnEmptyOnError` | Boolean | Required. If `true`, returns an empty rowset when parsing or XPath evaluation fails. If `false`, throws an exception. Specify as a named parameter. |

## Return Value

The function returns a rowset that contains the XML nodes selected by `xpathExpression`. Each row includes the node value, XML, and any attributes found in the selected nodes.

## Usage Example

This example selects the `Flight` nodes from an XML string.

```handlebars
{{#set flightsXml}}
  <root>
    <Flight origin="IND" dest="NYC">100.00</Flight>
    <Flight origin="IND" dest="LAX" carrier="UAL">200.00</Flight>
    <Flight origin="IND" dest="SEA">500<PerBagSurcharge>25</PerBagSurcharge></Flight>
  </root>
{{/set}}

{{#each (buildRowSetFromXml flightsXml "//Flight" returnEmptyOnError=false)}}
  {{Origin_att}}
  to
  {{Dest_att}}:
  {{Value}}
{{/each}}
```

The example produces this output:

```text
IND to NYC: 100.00
IND to LAX: 200.00
IND to SEA: 500
```
