Icon

Nested Customisable XML Generation with Components

Nested Customisable XML Generation from table
person_name person_id year of birthAndrew 101 1972Brian 108 1980Claire 103 2000Deborah 110 1995 Generate Nested customisable XMLAn introductory workflow to generate nested XML from two tables.Here, a table containing person_name, person_id and year_of_birth iscombined with a table containing person_id and job details (job title,company and date of joining)This flow builds on the original "Simple" flows I created, but this time buildsxml for the two tables and then combines the generated xml from each toform nested xml output (where job is contained as an element withinperson)Brian Bates @takbb 31 March 2021 Here we have a couple of components that I'veadded. The first takes the individual columnnames and converts them to upper case, aswell as converting spaces in names tounderscores.so "year of birth" becomes "YEAR_OF_BIRTH" This extracting of context properties and use ofJava Edit Variable is included here onlybecause I couldn't find a way of using relativefile paths with XML Row Combine and Write.There may be another way to do this that Icouldn't find, and In future, this may not benecessary.When adding the File Reader I found that thepath variable required for the WRITE was notcompatible with the one required for READ, so Ihad to add a second flow variable into the JavaEdit Variable node A second component thenconverts every column to XML Finally the individual columnXML values are combinedinto a single row XML value Columns to be converted to XML take thetop routeColumns that should not be converted toXML take the lower route (i.e. person_id) Job Company year of starting person_idAstronaut NASA 2009 101Bartender Bob's Nightclub 2016 108Chef Top of the Town restaurant 2018 103Doctor New London General Hospital 2005 110 Combine xml from person_id and person_name into a single xml columnArrange columnsinto theorder I wish for xml output.Manual table containing person_nameand person_idCollect Define xml filename relative relative to workflowas XML Row Combine & Writedoesn't have relative pathsManual table containing job detailsfor person_idReader added for convenience of inspecting the generated xmljoin the person_id back to the xml columnsJoin job XML columns with person XMLCombine collected Person Name, Person ID xml columnswith Job xml column as new XMLCombine collected job related xml columns into awith Jobxml column as new XML so this single piece of xml can be combinedlater with personPut rows together to write as a single XML fileWe want person_id available as non-xml as well as an xml versionso we effectively duplicate it hereand rejoin with the xml columns oncethey're doneJoin XML columns with person_id columnNode 78 XML CompatibleColumn Names XML Column Combiner Column Resorter Table Creator Extract ContextProperties Java Edit Variable Table Creator File Reader All Columns to XML Joiner Joiner XML Column Combiner XML Column Combiner XML Row Combineand Write Column Filter Joiner Column Splitter All Columns to XML XML CompatibleColumn Names person_name person_id year of birthAndrew 101 1972Brian 108 1980Claire 103 2000Deborah 110 1995 Generate Nested customisable XMLAn introductory workflow to generate nested XML from two tables.Here, a table containing person_name, person_id and year_of_birth iscombined with a table containing person_id and job details (job title,company and date of joining)This flow builds on the original "Simple" flows I created, but this time buildsxml for the two tables and then combines the generated xml from each toform nested xml output (where job is contained as an element withinperson)Brian Bates @takbb 31 March 2021 Here we have a couple of components that I'veadded. The first takes the individual columnnames and converts them to upper case, aswell as converting spaces in names tounderscores.so "year of birth" becomes "YEAR_OF_BIRTH" This extracting of context properties and use ofJava Edit Variable is included here onlybecause I couldn't find a way of using relativefile paths with XML Row Combine and Write.There may be another way to do this that Icouldn't find, and In future, this may not benecessary.When adding the File Reader I found that thepath variable required for the WRITE was notcompatible with the one required for READ, so Ihad to add a second flow variable into the JavaEdit Variable node A second component thenconverts every column to XML Finally the individual columnXML values are combinedinto a single row XML value Columns to be converted to XML take thetop routeColumns that should not be converted toXML take the lower route (i.e. person_id) Job Company year of starting person_idAstronaut NASA 2009 101Bartender Bob's Nightclub 2016 108Chef Top of the Town restaurant 2018 103Doctor New London General Hospital 2005 110 Combine xml from person_id and person_name into a single xml columnArrange columnsinto theorder I wish for xml output.Manual table containing person_nameand person_idCollect Define xml filename relative relative to workflowas XML Row Combine & Writedoesn't have relative pathsManual table containing job detailsfor person_idReader added for convenience of inspecting the generated xmljoin the person_id back to the xml columnsJoin job XML columns with person XMLCombine collected Person Name, Person ID xml columnswith Job xml column as new XMLCombine collected job related xml columns into awith Jobxml column as new XML so this single piece of xml can be combinedlater with personPut rows together to write as a single XML fileWe want person_id available as non-xml as well as an xml versionso we effectively duplicate it hereand rejoin with the xml columns oncethey're doneJoin XML columns with person_id columnNode 78 XML CompatibleColumn Names XML Column Combiner Column Resorter Table Creator Extract ContextProperties Java Edit Variable Table Creator File Reader All Columns to XML Joiner Joiner XML Column Combiner XML Column Combiner XML Row Combineand Write Column Filter Joiner Column Splitter All Columns to XML XML CompatibleColumn Names

Nodes

Extensions

Links