How to remove all tabs and break lines of XML file in data factory?

Vieira Dias, Leonor 20 Reputation points
2023-08-15T14:55:41.63+00:00

Hello,

I have an XML file and would like to combine all the lines of code into a single one. Manually, this is the equivalent of placing your mouse at the end of each line and pressing "delete" to join the next line to the current one. I tried using the Derived Column but it does not apply since I do not have columns and the file comes from the user therefore it will be different every time.

Once everything is combined in a single line, I want to find every time the word "name" appears and break the line there.

Example input:

<animals>
    <animal>
        <name>Lion</name>
        <species>Panthera leo</species>
        <habitat>Savannah</habitat>
    </animal>
    <animal>
        <name>Elephant</name>
        <species>Loxodonta africana</species>
        <habitat>African Plains</habitat>
    </animal>
    <animal>
        <name>Tiger</name>
        <species>Panthera tigris</species>
        <habitat>Forest</habitat>
    </animal>
</animals>

Output first stage:

<animals><animal><name>Lion</name><species>Panthera leo</species><habitat>Savannah</habitat></animal><animal><name>Elephant</name><species>Loxodonta africana</species><habitat>African Plains</habitat></animal><animal><name>Tiger</name><species>Panthera tigris</species><habitat>Forest</habitat></animal></animals>

Final output

<animals><animal>
<name>Lion</name><species>Panthera leo</species><habitat>Savannah</habitat></animal><animal>
<name>Elephant</name><species>Loxodonta africana</species><habitat>African Plains</habitat></animal><animal>
<name>Tiger</name><species>Panthera tigris</species><habitat>Forest</habitat></animal></animals>
Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,408 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,624 questions
Developer technologies XAML
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.