Closed femtotrader closed 3 years ago
@paulstey @mirestrepo That's intriguing @femtotrader.
I assume that you have used both? Do you have any comments on what nice features each library has?
XMLDict began as a set of convenience functions for dealing with AWS responses in AWSS3.jl and AWSSDB.jl.
My summary of XMLDict features follows:
xml_dict
and dict_xml
pair of APIs are round-trip tested against a large XML document (the XML standard REC-xml-20081126.xml).get(), getindex(), haskey()
) supports extracting info from XML without converting the whole document to a Dict
.:
e.g. xml["bookstore"]["book"][:category]
xml["Buckets"]["Bucket"]
below is a Vector
.xml = parse_xml("""
<ListAllMyBucketsResult>
<Buckets>
<Bucket><Name>quotes</Name><CreationDate>2006-02-03T16:45:09.000Z</CreationDate></Bucket>
<Bucket><Name>samples</Name><CreationDate>2006-02-03T16:41:58.000Z</CreationDate></Bucket>
</Buckets>
</ListAllMyBucketsResult>
""")
@test [b["Name"] for b in xml["Buckets"]["Bucket"]] == ["quotes", "samples"]
For my own use, one big difference is that XMLconvert can convert XML to MultiDict
and XMLDict can convert XML to simple Dict
, Vector
.
I was previously using XMLconvert for TALib.jl until I found XMLDict.
See https://github.com/femtotrader/TALib.jl/blob/master/src/describe.jl
I found much simpler to have Dict
, Vector
... than MultiDict
According doc, XMLconvert drops attributes of the XML (I don't care for my purpose... but it can be important for some usages)
When we first developed XMLconvert we were not aware of XMLDict. We were using it to handle large XML responses from PubMed/ClinicalTrials.gov. We also started out with the use of Dict and Vector instead of MultiDict, but we changed, as it bacame unpractical to be checking all the time whether we were accessing vectors or just the value in the key. At the beginning we were dropping attributes, but later wrote a method that converts the attributes to elements - and from then on they are handled in the same way. We've had in the back of our minds to try to reproduce our results using XMLDict to have a better sense of the advantages of each library. But we haven't found the time. XMLconvert also has few utility functions to flatten an XML and print the paths to all keys. We envisioned the library supporting functionality not only to convert to Dict but also to other formats (e.g JSON). Perhaps @paulstey can comment more on the specific features
XMLconvert.jl (https://github.com/bcbi/XMLconvert.jl) is now deprecated and archived.
So this issue can be closed.
cc: @femtotrader
https://github.com/bcbi/XMLconvert.jl seems to provide quite similar features.
Maybe a merge should be considered?
see https://github.com/bcbi/XMLconvert.jl/issues/5