XML to DataFrame (or just to a dict)

In a simulation code that I use, the output is stored in a plain text file and in an xml file. I have been parsing the plain text myself, but some things are hard to extract (requiring complex logic). It would be nice if I could just read the xml file directly into a dataframe. Or even if I could just read it all into a dict, it would be easier to handle.

I’ve never really traversed the trees in an xml file, and I don’t really know how to find a particular node and then count its number of children, etc. If it was in a dictionary, these kinds of things would be easier.

I tried out EzXML but the documentation isn’t comprehensive enough for a total XML beginner like me. All of the julia XML packages I could find seem to be a bit immature, abandoned, or both. I’ve spent the better part of 2 days working on this and haven’t made a lot of headway…

Is there a straightforward way to import an XML file into a dataframe or a dictionary? Or could someone point me to an XML library that is being maintained and that has enough documentation that an absolute XML noob could use it effectively?

Thanks!

Did you try XMLDict.jl? Still seems to work, it can convert XML to Dict.

1 Like

Thanks @mike.

In the end I decided not to use a dict, but to persist on figuring out how to do a little XML. The README file for LightXML had enough to get me started. I think I’ve got enough XML under my belt now to picking things out of a tree now.