Is it possible to generate XML files in KNIME that have a character encoding other than UTF-8? (I have tried adjusting the Knime preferences and generating a simple test XML file using the Table-Creator, Column-to-XML, and XML-Writer nodes )
I suppose my question can be split into 2:
Is there an easy way to encode string-test-data, which has been typed in the Table-Creator-Node to ISO-8859-1?
Is there a way to create ISO-8859-1 encoded XML files?
I have tried without success to:
- change the Knime preferences
- use the Vernalis encode/decode nodes,
- to write the data to an iso 8859-1 encoded .csv file and read the .csv data (iso-8859-1 encoded) before generating the XML-file)
Any help is much appreciated!
Have you tried a snippet already? Could maybe possible with python (java)
Do you mean for the XML-Generation?
I was hopeful, that someone generous had already solved this issue =) .
And I suppose I was hoping to not require conda.
(regarding Java snippets - I currently lack the knowledge).
I may try using Brian Gates XML Generator Components (@takbb) which I believe are python based.
It would be great to get confirmation from the KNIME Experts on whether or not the XML-Processing-Nodes support encoding other than UTF-8 (@knime)
I suppose writing the xml to an ISO8859 encoded csv and renaming the file would work (after replacing the string UTF-8)
Further notes on using the CSV Writer Method:
Attempting to replace the string “UTF-8” with “ISO-8859-1” in the String Manipulation Node crashes Knime.
The string replacer node works fine without issue.
In the CSV Writer the file ending can be defined as .xml and in the advanced settings to quote values the setting “never” seemingly leads to success.
Hi @mwakileh, thank you for taking a look at the xml generator component I wrote. I had great plans for it but ran out of spare time. I just took a look and currently it generates only UTF-8 but I’m happy to try to assist if I can.
The component as it stands, (as you say) does use Python. It isn’t the best-written python ever though. I’m happy to take a look though to see if encoding can be easily included. It does however pass the generated xml to the deprecated XML Writer node, as that was simpler for my purposes so I’m not sure if it will still cause issues. If you want me to investigate further, let me know!
pandas.DataFrame.to_xml method in python
allows to specifiy the ecoding when writing files.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.