There are lots of KNIME posts and examples of how to read and manipulate XML files, but I would like to build an XML file from scratch, using data contained within a flat file. Would someone be so kind to point me in the direction of how to get started.
I am looking to build an ODM file from data contained within a in-house data base. I just would like to know how I can bukid a schema that can then be filled with data.
My question is really how can I build up a very small XML, the bare bones e.g.
I really want to know how I can build seperate elements and fit them together without generating New elements when combining two XML cells. I will be building the XML from files, so the string to XML will not really help me as I need the XML to be dynamically built.
What about adding an XSLT node that transforms the current structure into the desired one?
You problem is very specific and it would be quite hard to do it even without KNIME. The only way I know of injecting XML fragments into existing documents is programmatically via the DOM API. There is no standard XML technique (such as XPath, XSLT, ...) I know of that achieves this. Therefore it's also hard to come up with node that is general enough to be useful for a wider group of users.
Your workflow is close to what you wanted, all that was missing was the naming of your root element and it's attributes. If you drop the column to XML node from your header branch, you can use those string values as attributes in the XML Element Properties tab of the XML Column Combiner configuration dialog.
Thanks for your workflow that is exactly what I wanted (I owe you a pint at the next UGM). I just have one more question:
I need to add a "Data Bound Attribute" in the last "XML Column Combiner" node. The name equals "xsi:schemaLocation". For some reason the node does not like the colon in the name. Is this a bug or by design? Like I said in my previous posts I am trying to reverse engineer an XML and they have this name.
Enhancement Request: It would be nice to have an "XML Column Resorter" node as I would like to have my Study Description above the Study Name, but the XML Column Combiner sorts automatically the columns alphanumerically. I know this will not make a difference to the final XML as all the data is there, but I would like my XML to be 1:1 identical with the one I am trying to replicate for QC purposes.