Re: [Haskell-cafe] [HXT] Simple question

I can't really reproduce this: A simple ghci session gives the following: ----------------------------------- uwe@si:~/haskell/hxt/curr/examples/arrows/HelloWorld> ghci HelloWorld.hs GHCi, version 6.8.1: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. [1 of 1] Compiling Main ( HelloWorld.hs, interpreted ) Ok, modules loaded: Main. *Main> runX $ (readString [(a_validate,v_0)] "<x> </x>" >>> writeDocumentToString []) Loading ... ... ["<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<x> </x>"]
Try "<x><y> </y></x>" and a_indent writing option.

Prelude Text.XML.HXT.Arrow> runX $ ( readString [(a_validate,v_0)] "<x><y> </y></x>" >>> setTraceLevel 4 >>> traceDoc "doc after reading"
s etTraceLevel 0 >>> writeDocumentToString [(a_indent, v_1)]) -- (1) doc after reading <x> <y/> </x>
content of: "<x><y> </y></x>" =============================
---XTag "/" | "source"="\"<x><y> </y></x>\"" | "encoding"="UNICODE" | "transfer-URI"="string:" | "transfer-Message"="OK" | "transfer-Status"="200" | "transfer-Encoding"="UNICODE" | +---XTag "x" | +---XTag "y" | +---XText " "
["<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<x>\n <y/>\n</x>\n"] We can see that the text node is here, but the <y> node is displayed as an empty node ! Thank you everyone, I report this to the HXT team.
Fernand

Hi Miguel,
Try "<x><y> </y></x>" and a_indent writing option.
yes, with the indent option set, whitespace becomes insignificant and will change during formating, and so the contents of the inner element reduces to empty Turn of the indentation and you get the result you want. Cheers, Uwe -- Web: http://www.fh-wedel.de/~si/ Sitz der Gesellschaft: Wedel Registergericht: Amtsgericht Pinneberg HRB 1578 Geschaeftsfuehrung: Prof. Dr. Dirk Harms
participants (3)
-
Fernand
-
Miguel Mitrofanov
-
Uwe Schmidt