I would like to parse an .mxl file (MusicXML) with clojure
So far i've seen a lot of tools to work with .xml files but I can't find a way to work with .mxl, maybe i should convert mxl to xml first but i don't know how to do that neither.
From the Wikipedia page on MusicXML:
The textual representation listed above is verbose; MusicXML v2.0 addresses this by adding a compressed zip format with a .mxl suffix that can make files roughly one-twentieth the size of the uncompressed version.[16]
I'm guessing that your .mxl file is an XML file which has been compressed, and this is why you're getting parse errors. As far I can gather, the compression algorithm is a zip algorithm, so you should be able to use java's zip functionality to get at it.
EDIT
I just had a go at this with a sample .mxl file I found online. The .mxl file, once unzipped contained the xml file within it. I was then able to use following (inspired by this answer) to get the raw XML...
(defn extract-mxl [path]
(let [[_ filename] (re-matches #"(.*)\.mxl$" (.getName (java.io.File. path)))
zipfile (java.util.zip.ZipFile. path)
zipentry (.getEntry zipfile (str filename ".xml"))
in (.getInputStream zipfile zipentry)]
(slurp in)))