Some workflows that I played with for generating XML

I looked at various resources on the forum and elsewhere for the creation of XML, both simple and complex (nested), but none of them quite answered my question (maybe I didn’t look hard enough, lol !).

I wanted to be able to create xml from one or more data tables, both in simple form and with nesting. Whilst Table to JSON followed by JSON to XML provided a quick way of turning a single table into xml, in my view it lost flexibility and didn’t handle nesting of a more complex XML structure, so I set about trying to put together a basic workflow example for replicating that simple form (one table becomes one xml file) without the JSON nodes.

The result of that was this first basic workflow.

With that worked out, I didn’t like the fact that I was having to hand craft a node for every column (which was one of the advantages of letting the JSON nodes do it for you!), and so I figured this part would have to become a loop. I also discovered that if my columns had spaces in the names, the process would fail so I needed to have something “standardise” my column names. So I create two reusable components to be slotted into the workflow without having to put the loop in the workflow. The components themselves do the looping through the columns:

and built this into a new “Simple XML” generation workflow

and then finally I decided that with this working, I needed to see how I could generate XML containing some nested information, so that two data tables could come together and be used to output as a single XML

I thought I’d share this as I know that just occasionally the same questions that I was asking myself come up on the forum. Enjoy and please do let me know if you spot bugs or you think of better, cleaner, or more efficient ways to do this!

3 Likes