# \[ANN\] TableIO - simple reading and writing of tabular data (experimental)

**URL:** <https://discourse.julialang.org/t/ann-tableio-simple-reading-and-writing-of-tabular-data-experimental/47427>\
**Category:** Package Announcements\
**Created:** [September 28, 2020, 6:01pm UTC](https://discourse.julialang.org/t/ann-tableio-simple-reading-and-writing-of-tabular-data-experimental/47427 "2020-09-28T18:01:43Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![sz1992](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sz1992/32/19219_2.png) [@sz1992](https://discourse.julialang.org/u/sz1992)\
**Post date:** [October 4, 2020, 9:31am UTC](https://discourse.julialang.org/t/ann-tableio-simple-reading-and-writing-of-tabular-data-experimental/47427/21 "2020-10-04T09:31:40Z")

</div>

Nice time saver. Is there a way to extend support for XML file strukture?

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [October 4, 2020, 6:06pm UTC](https://discourse.julialang.org/t/ann-tableio-simple-reading-and-writing-of-tabular-data-experimental/47427/22 "2020-10-04T18:06:08Z")

</div>

Thanks!  
The issue with xml is that there is no unique standard way how to represent a tabular structure. For automatic parsing, a specific structure of the xmls would need to be assumed, e.g. attributes top-level = row indices, attributes level 2 = column names and level 2 content = field value. Such a parser would, however, be not very useful because many xmls have a different scheme.  
For JSON, in contrast, it is easier because there are essentially only 2 ways to represent tabular data: list of dicts and dict of lists.  
In principle, it should be possible to write an xml parser which supports different schemes by providing information about content root, etc. as parameters, like here: [pandas-read-xml · PyPI](https://pypi.org/project/pandas-read-xml/)  
This would be, however, a much larger project (but surely very useful).

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [October 5, 2020, 12:50am UTC](https://discourse.julialang.org/t/ann-tableio-simple-reading-and-writing-of-tabular-data-experimental/47427/23 "2020-10-05T00:50:36Z")

</div>

> [@lungben](#):
>
> `read_table(filename / db connection, [tablename])`

I think this is better

`read_table([callable], filename, [table_name])`

The `callable` can be a function in which case `fn(table)` is what is read. And also you can put thing like DataFrame there and have a special dispatch for it. Like

`read_table(DataFrame, "path/to/file")` then ti will return a DataFrame, you can have it such that

`read_table(callable, path) = callable(_read_table(path))`

and

`read_table(::type{DataFrame}, path) = ... something customised code to make dataframe faster`

[Previous page](https://discourse.julialang.org/t/ann-tableio-simple-reading-and-writing-of-tabular-data-experimental/47427.md?page=1)
