Copying XML input to output in Haskell

According to the title. The application is a custom configuration files that may be updated from time to time in certain parts, but otherwise they should not be changed. The starting point is simply the ability to input input to output unchanged.

I agree that the inputs <tag></tag>

and <tag/>

are pretty much equivalent and probably won't differ in the output, but other than that, I would like to keep the XML as much as possible.

The first attempt was Text.XML.HaXml.SAX.saxParse , but it suppresses spaces after the comment, so for example:

<!-- next section: -->
<section>
    ...
</section>

      

parsed as:

<!-- next section: --><section>
    ...
</section>

      

which is an unacceptable change. The next attempt was via HXT at http://pastebin.com/qNyVuBK7 and it works well enough except that the objects in the attribute data are started; eg.

<view UID="&Label;" ifNotNull="&Term;">

      

becomes

<view UID="&amp;Label;" ifNotNull="&amp;Term;">

      

even though objects in normal text data are transmitted correctly. Can anyone suggest how to fix this latest issue or some other way to achieve the goal?

It seems like 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.

+3


source to share





All Articles