As per title. The application is user-written configuration files which might from time to time have to be updated in certain parts but otherwise should be unchanged. A starting point is just to be able to pass input to output unchanged.
I accept that the inputs <tag></tag>
and <tag/>
are pretty much equivalent and probably won't be distinguished on output but other than that, I'd like to preserve the XML as much as possible.
The first attempt was Text.XML.HaXml.SAX.saxParse but that suppresses whitespace after a comment so that for example:
<!-- next section: -->
<section>
...
</section>
is parsed as:
<!-- next section: --><section>
...
</section>
which is an unacceptable change. The next attempt was via HXT at http://pastebin.com/qNyVuBK7 and this works quite well except that entities in attribute data are munged; e.g.,
<view UID="&Label;" ifNotNull="&Term;">
becomes
<view UID="&Label;" ifNotNull="&Term;">
even though entities in normal textual data are passed correctly. Can anyone suggest how to fix that last problem, or another way to achieve the objective?
It seems that https://hackage.haskell.org/package/roundtrip-xml-0.2.0.0 might help but I can't find any documentation on how to use it.