Hello everyone,
Can you help me figure out how to convert an XML file to a string file? One important application is to use the string file in an LLM Prompter node because this node doesn’t recognize XML columns. There isn’t a dedicated node for this task.
I am attaching some solutions I’m testing.
Thank you.
Carlos
@CarlosEnrique84 The easiest way is to use XML to JSON node and then JSON to Table node.
Thank you prashant,
Using the JSON to Table converts the content to many columns. And the LLM Prompter only accepts one column. I also see that some information that could be helpful contained in the XML/JSON tags is lost when converting to a table.
However, I appreciate your contribution and will take it into account.
Hi prashant,
I tested your solution, and it’s giving me a similar result to solution 2 in the workflow I shared. The “good” result of both solutions is that the LLM interprets the string correctly.
I’m using this node sequence.
As an alternative you can use Xpath to just grab the root and output it as single cell of string type:
Output:
Demo wf with google.com as XML:
xmltostring.knwf (73.6 KB)
2 Likes
Thank you, Martin! Awesome solution! 
1 Like