Parsing
XML Parse
Pulls values out of XML held in a column into new columns, one XPath per column — or one row per repeating element such as an order line.
When to use it
Use it for XML from EDI, SOAP services, feeds or exports, when you know which elements or attributes you need.
In a pipeline
File InputXML ParseExport CSV
Settings
| Setting | Type | Required | Default or hint |
|---|---|---|---|
| XML column | select | Yes | Select column… |
| Columns → XPaths (JSON) | textarea | Yes | {"Order":"//Order/@id","Total":"//Order/Total"} |
| One row per node (XPath, optional) | text | — | e.g. //Order/Line — XPaths then read from each Line |
Example
Order header from XML
- Columns → XPaths (JSON)={"Order":"/Order/@id","Customer":"//Customer","Total":"//Order/Total"}
| File | Xml |
|---|---|
| po-7.xml | <Order id="7"><Customer>Acme</Customer><Total>120.50</Total></Order> |
| File | Xml | Order | Customer | Total |
|---|---|---|---|---|
| po-7.xml | <Order id="7"><Customer>Acme</Customer><Total>120.50</Total></Order> | 7 | Acme | 120.50 |
Worth knowing
- Supported XPath: /a/b, //a, relative paths, *, @attr, text(), . and .., with [1], [last()], [@id='7'] and [Name='x'] conditions. Namespace prefixes can be left off: //Order matches ns:Order.
- Set One row per node (e.g. //Order/Line) to get a row per line; the XPaths are then read from each Line, so Sku or @no means that line's own.
- When an XPath matches several nodes the first is used and the note says so.
- XML that is not well-formed is left blank and the note names the first problem.
- Values come out as text; use Type Conversion to turn Total into a number.