Icon

KNIME_​Demo Simple XML Generator -DEMO2

KNIME_Demo Simple XML Generator DEMO 2
XML Generator Demo 2- Read a CSV and output xmlwith manual editing of the control table to specify therequired outputREQUIRES PYTHON 3 to be installed in your KNIMEenvironment For demo purposes, launch the output filein the associated xml app in your environment.Remove this node if you have no associatedapp, or you don't wish to launch it. The "advanced" XML generation is performed by XML Generator being controlled by the MANUALLY EDITED control table, supplied by Table CreatorIf you set your Python Console Logging level to INFO, you will see a progress message every 1000 rows logged by the XML Generator.File-Preferences-> KNIME-> KNIME GUI -> Console View Log Level (o)INFO The XML Writer is supplied an output folder, andthat's pretty much it. It creates the file namebased on the RowID of the input data. The upper output port on XML Generator is the data in singleXML format, declared as KNIME XML data typeThe lower middle port is the same data but in multiple rows,as KNIME String data type. The lower port does not containreference to the ROOT xml node, as it represents onlyindividual rowsThe bottom port is a String table of individual lines of the XML -provided for flexibility in further manipulation or writing of thexml UPDATED: November 2022 with newcomponents This is just my quick way to providelocal file name variables that work withboth old and new file read/write components"born_outside_US.csv"Replace withyour data, and see if this willcontinue to work with no config changesrequired for basic table/row xml output...(That's the aim!)Manually EditedControl table originally createdby the Create XML Generator Control Table componentSort by native-countryThe control table generated in demo1 has now been manuallycopied/pasted into Table Creator whereupon it can be edited.I am too lazy to rename the columns in Table Creator soI used by "Rename Table Creator Columns" componentto receive the required column names from the Create XML Generator Control Table component, and apply these to the output of the Table Creator before passing it on to XML Generator.Useful for debuggingThe upper port simply passes through thecontrol table.The lower port "visualises" the structure of thecontrol table simply forvisual inspection anddebugging purposesThis isn't always necessarybut I recommend youalways add it anywayGenerates XML from source tablebased on supplied control tableConfig for this node is simply the name of the output file(without the .xml extension). This is the name that will beused by the XML WriterZero config default:output_xmlWrite using pretty printngOr write using CSV Writerwithout pretty printingTurn off Write-headerTurn off Write Quotes (advanced tab)View workflow datafolder in explorer Local FileName Variables CSV Reader Table Creator Sorter Create XML GeneratorControl Table XML ControlTable Renderer Override XML GeneratorControl Table XML Control Table- Finalizer XML Generator XML Writer CSV Writer Open File or Folder XML Generator Demo 2- Read a CSV and output xmlwith manual editing of the control table to specify therequired outputREQUIRES PYTHON 3 to be installed in your KNIMEenvironment For demo purposes, launch the output filein the associated xml app in your environment.Remove this node if you have no associatedapp, or you don't wish to launch it. The "advanced" XML generation is performed by XML Generator being controlled by the MANUALLY EDITED control table, supplied by Table CreatorIf you set your Python Console Logging level to INFO, you will see a progress message every 1000 rows logged by the XML Generator.File-Preferences-> KNIME-> KNIME GUI -> Console View Log Level (o)INFO The XML Writer is supplied an output folder, andthat's pretty much it. It creates the file namebased on the RowID of the input data. The upper output port on XML Generator is the data in singleXML format, declared as KNIME XML data typeThe lower middle port is the same data but in multiple rows,as KNIME String data type. The lower port does not containreference to the ROOT xml node, as it represents onlyindividual rowsThe bottom port is a String table of individual lines of the XML -provided for flexibility in further manipulation or writing of thexml UPDATED: November 2022 with newcomponents This is just my quick way to providelocal file name variables that work withboth old and new file read/write components"born_outside_US.csv"Replace withyour data, and see if this willcontinue to work with no config changesrequired for basic table/row xml output...(That's the aim!)Manually EditedControl table originally createdby the Create XML Generator Control Table componentSort by native-countryThe control table generated in demo1 has now been manuallycopied/pasted into Table Creator whereupon it can be edited.I am too lazy to rename the columns in Table Creator soI used by "Rename Table Creator Columns" componentto receive the required column names from the Create XML Generator Control Table component, and apply these to the output of the Table Creator before passing it on to XML Generator.Useful for debuggingThe upper port simply passes through thecontrol table.The lower port "visualises" the structure of thecontrol table simply forvisual inspection anddebugging purposesThis isn't always necessarybut I recommend youalways add it anywayGenerates XML from source tablebased on supplied control tableConfig for this node is simply the name of the output file(without the .xml extension). This is the name that will beused by the XML WriterZero config default:output_xmlWrite using pretty printngOr write using CSV Writerwithout pretty printingTurn off Write-headerTurn off Write Quotes (advanced tab)View workflow datafolder in explorerLocal FileName Variables CSV Reader Table Creator Sorter Create XML GeneratorControl Table XML ControlTable Renderer Override XML GeneratorControl Table XML Control Table- Finalizer XML Generator XML Writer CSV Writer Open File or Folder

Nodes

Extensions

Links