XPath Expressions
Overview
DataPipeline's query engine uses a subset of XPath 1.0 location paths notation to identify field values and demarcate records in XML, JSON, and Java objects.
Axis Specifiers
| Axis | Abbreviated Syntax | Supported | Examples |
|---|---|---|---|
| ancestor | |||
| ancestor-or-self | |||
| attribute | @ | yes | @lang or attribute::lang |
| child | yes | title or child::title | |
| descendant | yes | ||
| descendant-or-self | // | yes | //book or /descendant-or-self::book/ |
| following | |||
| following-sibling | |||
| namespace | |||
| parent | .. | ||
| preceding | |||
| preceding-sibling | |||
| self | . | yes |
Node Tests
comment(), text(), processing-instruction(), node() are all supported.
Predicates, Functions and Operators
Not supported.
Special Symbols
DataPipeline supports escaping symbols that have special meaning in XPath. For example:
- If you have a node name that looks like
Price (£), you can include it in an XPath location path by wrapping the name in backticks (also known as backquotes, grave accents, or graves):addField("COL_1", "/object/table/array/object/`Price (£)`"). - If the node name includes a backtick, such as
Price `£`, you can escape them by doubling each backtick:addField("COL_1", "/object/table/array/object/Price ``£``").
Wildcards
DataPipeline supports wildcards inside of XPath expressions using asterisks. For example, you can match nodes that starts with Price by using: addField("COL_1", "/object/table/array/object/Price*").
- When wildcards are in play, the node test becomes case insensitive allowing you to use:
addField("COL_1", "/object/table/array/object/PRICE (*)")oraddField("COL_1", "/object/table/array/object/price (*)"). - Wildcards can be placed inside backticks if they include symbols:
addField("COL_1", "/object/table/array/object/`Price (*)`"). - If the node name includes asterisks (Price *£*), you can escape them by doubling each asterisks:
addField("COL_1", "/object/table/array/object/`Price **£**`").
