Blending Bull Rule: Align XML Feed to Table#

The Align XML to Table rule allows you to change the structure of an XML file into a table-like view similar to a CSV file. It is designed primarily for processing data sources in XML format.

What is the rule for?#

The main purpose of this rule is to bring the XML file visually and structurally closer to CSV format. It is ideal for situations where you need to:

  • Make a large XML feed easier to read.

  • Prepare data for systems that process data row by row more efficiently.

  • Apply rules that are much easier to configure on row-structured data.

  • Use regular expressions within individual items.

How does the rule work?#

When this rule is applied, Blending Bull searches the data source for a specific defined element that marks one item (e.g. <SHOPITEM>). Once it identifies this tag, it ensures that each item is on a single row.

Blending Bull therefore removes line breaks, certain whitespace characters, and adds new line breaks using this rule. It does not process the content of rows, and therefore does not guarantee the order of elements within individual rows either. If a specific order is needed, it must be set using additional rules.

Example of how the rule works#

Data source (XML):

<SHOPITEM>

    <ITEM_ID>1</ITEM_ID>

    <PRODUCTNAME>White mug Karel</PRODUCTNAME>

    <PRICE_VAT>123</PRICE_VAT>

</SHOPITEM>

<SHOPITEM>

    <ITEM_ID>2</ITEM_ID>

    <PRODUCTNAME>White mug Maruška</PRODUCTNAME>

    <PRICE_VAT>456</PRICE_VAT>

</SHOPITEM>

When configuring the Align XML to Table rule, enter <SHOPITEM> as the element that marks one item. After applying the rule, the output file will look like this:

<SHOPITEM><ITEM_ID>1</ITEM_ID><PRODUCTNAME>White mug Karel</PRODUCTNAME><PRICE_VAT>123</PRICE_VAT></SHOPITEM>
<SHOPITEM><ITEM_ID>2</ITEM_ID><PRODUCTNAME>White mug Maruška</PRODUCTNAME><PRICE_VAT>456</PRICE_VAT></SHOPITEM>

Each item (<SHOPITEM>) is on its own individual row.

How to configure the rule#

  • In the interface of the selected file, on the Edit file tab, click Create new rule.

  • Enter a Name for the rule.

  • As the Rule type, select Align XML to Table.

  • Enter the name of the element that marks one item in the feed (e.g. SHOPITEM).

  • Click Save. After regeneration, the data preview on the right side of the screen will show that each item is on one row.

Use cases#

  • The rule makes it easy to work with regular expressions within individual items. For example, adding new elements, splitting elements with parameters into multiple elements, deleting parts of data, etc. — whitespace characters and line breaks in XML layout make this more difficult otherwise.

  • After aligning the data into a table, it is much easier to apply additional rules, such as Delete line containing text or Delete empty lines.

FAQ#

What does the Align XML to Table rule do?#

It moves each XML feed item to a separate row, structurally bringing the XML file closer to CSV format. The result looks like a table where each row represents one item.

What data format is the rule designed for?#

The rule is designed primarily for data sources in XML format. It does not apply to other formats such as CSV or JSON.

What exactly does the rule do to the file?#

It removes line breaks and certain whitespace characters within each item and adds new line breaks so that each item is on one row. It does not modify the content of individual elements.

Does the rule guarantee the order of elements within a row?#

No. The rule does not guarantee the order of elements within individual rows. If you need a specific order, it must be set using additional rules.

What element should I enter when configuring the rule?#

Enter the name of the element that marks one item in the feed — for example, SHOPITEM. Blending Bull will then ensure that each occurrence of this element is on a separate row.

Why is aligning to a table beneficial?#

After alignment, each item is on one row, which significantly simplifies working with additional rules. Regular expressions targeting the content of individual items are easier to configure, and rules that work at the level of entire rows — such as Delete line containing text or Delete empty lines — work more reliably.

Where in Blending Bull do I configure the rule?#

In the interface of the selected file, go to the Edit file tab, click Create new rule, select Align XML to Table as the type, enter the name of the element that marks one item, and save.

Was this article helpful?