# XML to DataFrame (or just to a dict)

**URL:** https://discourse.julialang.org/t/xml-to-dataframe-or-just-to-a-dict/52656
**Category:** General Usage
**Tags:** xml
**Created:** [December 31, 2020, 11:45am UTC](https://discourse.julialang.org/t/xml-to-dataframe-or-just-to-a-dict/52656 "2020-12-31T11:45:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Gus\_Hart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gus_hart/32/6987_2.png) [@Gus\_Hart](https://discourse.julialang.org/u/Gus_Hart)
#### Post date: [December 31, 2020, 11:45am UTC](https://discourse.julialang.org/t/xml-to-dataframe-or-just-to-a-dict/52656/1 "2020-12-31T11:45:17Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![mike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mike/32/39_2.png) [@mike](https://discourse.julialang.org/u/mike)
#### Post date: [December 31, 2020, 11:59am UTC](https://discourse.julialang.org/t/xml-to-dataframe-or-just-to-a-dict/52656/2 "2020-12-31T11:59:36Z")

</div>

Did you try [XMLDict.jl](https://github.com/JuliaCloud/XMLDict.jl)? Still seems to work, it can convert XML to `Dict`.

---

<div class="post-metadata">

### Author: ![Gus\_Hart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gus_hart/32/6987_2.png) [@Gus\_Hart](https://discourse.julialang.org/u/Gus_Hart)
#### Post date: [January 4, 2021, 11:27am UTC](https://discourse.julialang.org/t/xml-to-dataframe-or-just-to-a-dict/52656/3 "2021-01-04T11:27:46Z")

</div>

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.
