[Haskell-cafe] [HXT] Simple question

Uwe Schmidt uwe at fh-wedel.de
Thu Dec 20 06:35:58 EST 2007


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 at 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/


More information about the Haskell-Cafe mailing list