XML Generator

XML Generator component. This requires Python 3 to be installed.

Requires two data feeds. The top input port is the data to be processed. The bottom input port takes a control "script" that describes the output required.

The control feed is a table consisting of 3 columns:
option%%00009%%00009| %%00009 key %%00009| %%00009 value

The option - key pairs are as follows:

header %%00009- Root -%%00009name of the root element
%%00009This is the name to be given to used for the root element of the xml

header%%00009- Row -%%00009name of the primary "record/row" element
%%00009This is the element name to be used for each record/row generated

tag%%00009- -%%00009


%%00009This is the internal "tag name" that you will use to refer to a
%%00009given tag. Normally it will be the same as the table column,
%%00009but it doesn't have to be.

tag_type - -
%%00009This is the type of xml item to be generated for the given
%%00009tagname and is one of the following: group, element, attribute,
%%00009comment.
%%00009An element may itself be a group, but differs from a group in that
%%00009the group does not have any value of its own. The distinction
%%00009between group and element is therefore minor.

parent - -
%%00009This indiciates that the given element identified by tagname is
%%00009directly subordinate to the element identified as parent-tagname
%%00009and will therefore be containined within it. Elements will be
%%00009generated on the XML output in the order in which they appear in
%%00009the "parent" commands.

display - tagname - display-name
%%00009This identifies what the actual element name to be output
%%00009for a given tagname will be. It allows you to specify a
%%00009different name to the table column name. By default, the
%%00009element name will be the tagname defined here, if no
%%00009display command is specified.

breakonchange - -
%%00009For a group tag outputting repeated data, if breakonchange
%%00009is specified, the repeated data is output within the group
%%00009without repeating all other items from the input table.
%%00009Only when the value of the tag specified by
%%00009has changed does the next row get output.

ifblank%%00009- -
%%00009The value to be output if the data for the specified
%%00009tag is blank.

ifzero - -
%%00009The value to be output if the data for the specified
%%00009tag is zero

ifmissing - -
%%00009The value to be output if the data for the specified
%%00009tag is missing

literal - -
%%00009Specify a literal value to be output instead of a column
%%00009name. The value may optionally include other tags inside
%%00009{ } in which case the term literal is a slight misnomer as
%%00009the value output will be dynamic. It may then contain the
%%00009output of one or more other tags. A literal can therefore be
%%00009formed of a number of other tags.

comment - -
%%00009Specify a comment value to be output The output will
%%00009be inside comment tags in the generated xml.
%%00009The value may optionally include other tags inside
%%00009{ } in which case the value output will be dynamic.
%%00009It may then contain the%%00009output of one or more other tags.
%%00009Where a comment declaration is used, there should also
%%00009be a tag_type declaration defining this tag as a comment
%%00009tag. A comment declaration where there is no corresponding
%%00009comment tag_type will have no effect and will be ignored.

numeric - - Y
%%00009Explicitly states that the given tag is to be treated
%%00009as numeric.

integer - - Y
%%00009Explicitly states that the given tag is to be treated
%%00009as integer.

hideifmissing - - Y
%%00009States that the tag is not to be output if the data
%%00009value is missing, and in the case of group elements
%%00009that no subordinate elements have been output

hideifblank - - Y
%%00009States that the tag is not to be output if the data
%%00009value is blank, and in the case of group elements
%%00009that no subordinate elements have been output

NOTE THAT THIS IS VERY MUCH BETA (PROTOTYPE)
- FEEL FREE TO USE [AT YOUR OWN RISK] - BUT FEEDBACK WELCOME
@takbb Brian Bates May 7th 2021

Options

Output xml file name
Name to be used for Output xml file. This will be applied as the ROWID for the generated XML data output port, so that it will be used by an XML Writer component.%%00010%%00010If using XML Writer, the extension .xml will be automatically appended, so do not include it here

Input Ports

Icon
The input data to be convereted to XML
Icon
The control details that will be used to generate the XML

Output Ports

Icon
The generated xml
Icon
The generated row-by-row xml in String format, without the xml header or root element

Nodes

Extensions

Links

NodePit is the world’s first and most comprehensive search engine that allows you to easily search, find and install KNIME nodes and workflows. Explore the KNIME community’s variety.

Impressum / Imprint
Datenschutzerklärung / Privacy Policy
Status

Thank you to the following supporters — without them, NodePit would not be possible!

Legal info: The KNIME® trademark is registered in the United States and Germany by the KNIME GmbH. NodePit is not affiliated with KNIME®.