🐮 How to align an XML feed to a "table"

The Blending Bull application version 4.0 has brought a new rule type Align XML to a table. This changes how processing of data feeds in the Blending Bull application should be perceived.

:question: What does the “Align XML to a table” rule do

The rule removes line breaks, some whitespace characters, adds new like breaks. So that one item of goods (or what other data you are processing) was on one line. See a simple example.

Data source:

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

When we apply the Align XML to a table rule, enter SHOPITEM element, the output file will look as follows:


Each SHOPITEM will thus be on its own line.

:bulb: Comments on the rule

  • The rule only removes whitespace characters between XML elements and it will amend line breaks in such a way so that they were at the place </elementnameenteredbyuser>HERE. It is not concerned with the content on the lines. It does not guarantee the order of XML elements on individual lines. It is the same as in data sources on the input. It is possible that a data source contains elements in all SHOPITEMS in the same order. This, however, cannot be relied on 100%. If we wanted for example to convert XML to CSV, it would be advisable to check the order of elements, or to set it up using further rules.
  • Line length that Blending Bull can process, is limited. In practice, I have not reached the limit yet. But it can happen.
  • Rule name “Align XML to a table” was derived from the similarity of XML processed in this way with CSV, or with a table in e.g. Excel.
  • The rule is primarily intended for processing data sources in the XML format. In the application, you will always see it and you can also always use it.

:open_book: Why was the rule created

The goal was to work with regular expressions inside SHOPITEMs. E.g. to add new elements, divide elements with parameters into more elements, delete parts of data … In these activities, whitespace characters and line breaks caused problems. Inspiration came from CSV. In CSV data for one SHOPITEM are on one line. In XML it is not a problem to have one SHOPITEM on one line. But it is not common. Transfer of data into this structure removed a number of problems in processing of files on the level of characters in Blending Bull.

:hammer_and_wrench: Application of the rule

In extra posts I will show you how to e.g. set up the order of elements in one SHOPITEM. And more examples can be found. In such situations it will be great if our following rule will be able to assume a certain format of characters of the input.

I guess that you can already think of ways to use this rule. For further inspiration, follow #apps:blending-bull :wink: