openlilylib / lilypond-export

LilyPond export API to write Humdrum, MusicXML and more
GNU General Public License v3.0
22 stars 8 forks source link

Use SXML to XML conversion for MusicXML export #9

Closed PaulMorris closed 5 years ago

PaulMorris commented 5 years ago

Given that we are in the land of Scheme, why not use SXML? And since we're only converting from SXML to XML, and not the other way around, it was relatively straightforward to copy about ~150 lines of code from Guile 2.x's sxml simple module for the purpose. (Here's the full sxml simple source code.)

There's further to go in this direction, but I didn't want the changes to get any larger.

One small drawback is that by default the sxml->xml function doesn't add line breaks, so the output is not as well formatted for reading, but there are ways to get that back if we want it.

A big benefit is that this approach has been discussed (and used during the Summer of Code project) for adding MusicXML export to LilyPond. So it aligns with that goal. If and when LilyPond moves to a more recent version of Guile, we can easily switch to using the Guile SXML module(s) directly.

jpvoigt commented 5 years ago

This is already merged through branch PaulMorris-sxml.