Automation with xml files

Hey guys! I’m new to this amazing community.
I’m studying the tool, but I’m not finding a solution and I need help.
I’m wanting to manipulate multiple xml files (edit, remove attributes…) from dropbox (or any other font needed). But I am not able to access the attributes of these multiple files. What do you suggest?

Hey @Guilherme_Hirsch!

Welcome to the community :sparkling_heart:

Did you try the XML node?

If you just want to extract information, you can also use the HTML Extract node.

Tried through a dropbox node with the “list” operation. This was returned to me:

After that I created an xml node to transform the xml into json (from what I understand this is how you handle n8n). However, I don’t have access to the internal attributes of the xml files.

Ah yes. This is only returning the list of files and not the actual files. You will have to get the files to get the content. You will have to connect to another Dropbox node to download the files and reference the path from the previous node. Then connect the XML node to read the data.

This workflow might help you

You can copy the above code and paste it into your n8n instance!

Will this make it possible for me to read one file only?

This will read all the files that the first Dropbox node returns.

Wow! What is the Property Name I use in node xml?
I go to “edit expression” from node xml, and look for a json variable from the previous node?

Did you change the value of the Binary Property field in the second Dropbox node? By default, it is data. This is the value you can need to use in the Property Name field in the XML node. You don’t have to use the Expression Editor here.

Here’s an example:

It is showing an error

Hey!

Can you share the screenshot of the previous node? I want to make see what output you’re getting there.

Thanks! Does the node return 48 binary items as well? Right now I can only see JSON items. It seems like the node doesn’t have 48 binary items. One of the records from dropbox is missing the binary property. The node is giving you an error because it is trying to execute 48 times (each time for an item), but not every item contains binary data. Let me know if this makes sense.

This information is correct. The dropbox directory has 48 binary items (xml files). The idea is to manipulate the internal attributes of each xml, as they have the same schema.

Hey,
Thank you for sharing the files. I found the issue and here’s the workflow that would help

Wow! It worked!

Through this, is it possible to have access to the schema of each xml file? Have access to the “ide” tag, for example.

I finally found the solution! After a lot of research and testing. What was missing, after the second node, is a “Move Binary Data” node. That way I was able to convert to json to manipulate the data. Thank you @harshil1712 for your tireless help. Thank you so much!

I am glad you found the solution! Have fun :slight_smile:

1 Like