[Haskell-beginners] XML output

Torsten Otto T-Otto-News at gmx.de
Tue Sep 4 22:33:56 CEST 2012


Hi, all!

I'm struggling with a strange phenomenon.
If I read a file containing

__
a
b
c
__

the program below works as expected. If I read a svg file
__
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="180" height="180" fill="white"/> 
</svg>
___
the first two lines are not processed.

Program:
__
module SVG()
where

import IO

main :: IO ()
main = do
 s <- readFile "sierpinski1.svg"
 putStrLn s
 writeFile "sierpinski1_.svg" s
__

Results of putStrLn:
__
*SVG> main
a
b
c
*SVG> main
<rect x="0" y="0" width="180" height="180" fill="white"/> 
</svg>
*SVG> 
__

File Output lists the whole file, though.

I don't understand this, why is GHCi stripping the output this way?

Thanks,
regards,
Torsten



More information about the Beginners mailing list