# Parsing xml file with animation nodes

I've an XML which includes position and rotation information and which I need to parse it in order to use it with animation nodes. This is something I already managed to do via python scripting but as its much easier to interact with nodes I would like to replicate it within AN. My problem is that even if my script works it seems that things are done differently in AN, somehow importing the xml.etree library has no effect on my xml, this is how it looks now:

I'm almost sure it has something to do with how I'm using inputs but as I'm new to coding I can't figure it out. As you can see in the image it seems that the node script cant access the file input (xml).

Any ideas on how it should be done? Thanks in advance

• Please attach a .blend so we can more easily work on your question – WhatAMesh Aug 11 '18 at 13:24
• Done. I'm not sure how to share the xml, so if needed i'll be happy to post it via a link. – Juan Manuel Lynch Aug 11 '18 at 13:55
• I'm not sure either, anything would work for me. Dropbox? – WhatAMesh Aug 11 '18 at 14:00
• there you go, google drive link – Juan Manuel Lynch Aug 11 '18 at 14:08

The ElementTree.parse() function takes a filename or file object for the xml file as an argument. In your script node, xml is a string and not a filename or a file object and hence the error.
Instead, you can use the ElementTree.fromstring() function which takes a string representing the xml file. Note that the output is the root of the tree and thus getroot()` needn't be used.