Convert to file for XML

Describe the problem/error/question

Hi everyone,

so I am looking to create a flow where I can upload a ppt file, then unzip it and edit some of the XML files representing the slides. Now in order to test that the integrity of the files work, I have the workflow below. My key problem however is now that the Convert to File node does not offer XML as an output, despite the Extract from File doing so. I have tried all file formats, but none give a syntactical correct XML file to disk. I have also tried plugging the output of JSON to XML directly into the write disk, but that doesn’t work because it is not binary.

All the previous flows I saw doing some writing to disk of XML files, use old nodes for binary conversion, no longer available in my deployment.

So any help on how to accomplish the writing to disk with the correctly converted file would be highly appreciated.

Thanks a lot,

Best regards

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

data
File Name:
file.txt
File Extension:
txt
Mime Type:
text/plain
File Size:
124 kB

Information on your n8n setup

  • n8n version: 1.108.2
  • Database (default: SQLite): SQLLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Windows 11

Hey @gilgusmaximus, welcome to the community.

Try changing the name (in options) to something.xml and see if the mimetype just kicks in ther.

Hi Thanks a lot for the idea @jabbson . Just tried it out on the convert to file node, unfortunately that also did not work. Another idea I tried just now is using a code node to encode the file as base64 and then use that with the option for base64 to file, but that also does not work. In the same way I have attempted to write the file via a code node to the disk

# Loop over input items and add a new field called 'myNewField' to the JSON of each one
for item in _input.all():
  item.json.myNewField = 1
  with open("demofile.xml", "w") as f:
    f.write(item.json.data)
  print(item.json.data)
 

return _input.all()

But this also does not create a file unfortunately.

Any further ideas would be appreciated :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.