
Hi, I'm using HXT (7.4) with GHC to make some XML transformations (BTW, congratulations to the maintainers of that package for their impressive work). Everything works fine except for the fact that all the nodes « <this> </this> » (that is, a space (an XML text node whose contents are a single space character) within a <this> element node) get transformed to a « <this/> » element node, which I do not want (I want to keep those nodes as they are). Note that my transformations do not change the <this> nodes or their children (my transformations works on others parts of the document). This seems to be related to the XML parsing or writing of the XML file, and I have tried several read/write options (using a_remove_whitespace and a_canonicalize with v_0, for both writing and reading) to prevent this behaviour, without success. I have even tried to add text childs nodes to all the empty <this> nodes, but the issue seems to lie in the XML output options. Has anybody an idea ? Excuse me if this is a trivial issue, Sincerely yours Fernand -- Excuse my french, it's my mother tongue.

Hi Fernand,
Everything works fine except for the fact that all the nodes « <this> </this> » (that is, a space (an XML text node whose contents are a single space character) within a <this> element node) get transformed to a « <this/> » element
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>"] *Main> runX $ ( readString [(a_validate,v_0)] "<x> </x>" >>> setTraceLevel 4 >>> traceDoc "doc after reading" >>> setTraceLevel 0 >>> writeDocumentToString []) -- (1) doc after reading <x> </x> content of: "<x> </x>" ====================== ---XTag "/" | "source"="\"<x> </x>\"" | "encoding"="UNICODE" | "transfer-URI"="string:" | "transfer-Message"="OK" | "transfer-Status"="200" | "transfer-Encoding"="UNICODE" | +---XTag "x" | +---XText " " ["<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<x> </x>"] *Main> -------------------------------------- So there is a text node containing the space char after parsing and it stays in the output document. Cheer, Uwe -- Web: http://www.fh-wedel.de/~si/
participants (2)
-
Fernand
-
Uwe Schmidt