background preloader

Haskell and XML

Facebook Twitter

Xml-to-json is now a library. A while back I needed to convert a ton (millions) of small xml files to json, so I could store them in MongoDB.

xml-to-json is now a library

To that end I wrote a teensy-tiny tool called xml-to-json (github, Hackage). Originally it was just a command-line tool with all the code thrown in a single file. So, I did a quick refactor this week to split it into a library + executable, and pushed it to github (to deafening cries of joy). Features First, a non-feature. xml-to-json is “optimized” for many small xml files.

Haskell - How to lazy process an xml documentwith hexpat. Text.XML.Expat.Pickle. Description hexpat-pickle provides XML picklers that plug into the parse tree of the hexpat package, giving XML serialization with excellent performance.

Text.XML.Expat.Pickle

Picklers are source code similar to those of the HXT package. The concept and design was lifted entirely from HXT. The API differences between HXT and hexpat-pickle are: PU and XmlPickler take one extra argument, indicating the part of the XML tree we are working with.

HXT