The route

XML: row elements and attributes

Download the exercise files

A table has rows by definition; an XML document has whatever its author decided. To read one into rows you tell Odara one thing — which element is a row — and it flattens each of those into a record, attributes included. Pick the wrong element and you don't get an error; you get quietly wrong data. This level shows you both kinds of wrong.

Goal

An XML Source that reads catalog.xml into 16 rows — one per product — with seven columns, including the currency that lives in an attribute.

You'll need

  • The exercise files for this level: catalog.xml.
  • About 18 minutes.

Open catalog.xml in a text editor before anything else. Its shape:

<catalog generated="2026-01-08" source="odara-academy">
  <meta>…</meta>
  <products>
    <product sku="P-100-S" category="seats" active="true">
      <name>Starter seat (standard)</name>
      <price currency="EUR">29.00</price>
      <billing>monthly</billing>
    </product>
    …
  </products>
</catalog>

Steps

1. Read it with the defaults

Create a pipeline w2-3-catalog. From INGEST ▸ Files drop an XML Source named catalog, set File Path, leave Row Element as it comes — row — and click Preview Output.

Row Element "row": a successful read of nothing

Nothing. No error, no columns, zero rows. There is no <row> element in this file, so there was nothing to turn into a row — and "nothing" isn't an error. Remember this one: a pipeline built on it runs green and writes an empty file.

2. Point at the container instead

A natural second guess is the element that holds the products. Set Row Element to products and preview.

Row Element "products": everything collapsed into one row

One row. Every product inside <products> was flattened into the same record, each one overwriting the last, so what's left is the last product in the file — P-400-A. The column names give it away too: product__sku, product__category — the reader is describing children of the row, not the row.

3. Point at the repeating element

The row is the element that repeats once per record. Set Row Element to product.

Row Element "product": sixteen rows, attributes as columns

Sixteen rows and seven columns:

Column Came from
sku, category, active attributes of <product>
name, price, billing child elements
price__currency the currency attribute of <price>

Attributes on the row element become plain columns. Attributes on a child element become <child>__<attribute> — without that rule, <price currency="EUR"> would lose its currency.

4. Look at it

Add a Console (DELIVER ▸ Debug), connect it, Row Limit 20, Execute, and expand the output. Find the one product with active = false.

Expected result

  • 16 rows (8 products × 2 billing terms), 7 columns in the order sku, category, active, name, price__currency, price, billing.
  • First row: P-100-S, seats, true, Starter seat (standard), EUR, 29, monthly.
  • Exactly one inactive product: P-400-A, the annual API calls pack.
  • <meta> and the attributes on <catalog> are not in the output — they're outside the row element, so they're outside the rows.

Common pitfalls

Zero rows and a green run. The Row Element doesn't exist in the file. Check spelling and case — Product and product are different elements.

One row with the values of the last record. You pointed at the container. Point at the element that repeats.

Prefixed elements like <cat:product>. If the file uses a namespace prefix on its row element, the Row Element has to include the prefix exactly as written in the file: cat:product.

An attribute column is missing. Only attributes on the row element and its direct children become columns. Anything above the row (<catalog generated="…"> here) isn't part of any row.

What you built

A reader that turns a document into a table. The only decision was the row element, and you now know what each wrong answer looks like — which matters more, because the wrong answers don't fail.

Check yourself

One question, drawn from a larger bank. Get it right to pass.

  1. Where do `sku`, `category` and `active` come from?