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
equality xml copy haskell


source to share


No one has answered this question yet

Check out similar questions:

2227
How do I clone or copy a list?
2112
How do I copy a file in Python?
2024
How do you parse and process HTML / XML in PHP?
1930
What is the difference between the "COPY" and "ADD" commands in the Dockerfile?
1592
How to copy a folder from remote to local?
822
What does <! [CDATA []]> in XML?
757
Getting started with Haskell
756
How do I copy an object in Java?
754
What is the difference between deep copy and shallow copy?
534
Large-scale design in Haskell?



All Articles
Loading...
X
Show
Funny
Dev
Pics