[Haskell-cafe] [HXT] Simple question

Fernand quarantedeux42 at yahoo.fr
Wed Dec 19 12:21:24 EST 2007

Miguel Mitrofanov a écrit :
> Seems rather strange for me, I've just installed HXT and got this:
> Prelude Text.XML.HXT.Arrow> runX $ readString [(a_validate,"0")] "<this> </this>" >>> writeDocumentToString []
> ["<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<this> </this>"]
>> 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,
Thank you for investingating this : that made me realize that the issue 
comes from the a_indent option. What is strange is that this does not 
seems to appear with your example

runX $ readString [(a_validate,"0")] "<this> </this>" >>> 
writeDocumentToString [(a_indent, v_1)]
["<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<this>\n</this>\n"]

But if I try the same with my XML file, my empty nodes are "folded". I 
suppose this comes from the "Ctrl-M" at the end of the lines.
See the attached file and you may see that

runX $ readDocument [(a_validate, v_0)] "ftest.5.11e.xdp" >>> 
writeDocumentToString []

produces « <text> </text> » nodes (OK), but

runX $ readDocument [(a_validate, v_0)] "ftest.5.11e.xdp" >>> 
writeDocumentToString [(a_indent, v_1)]

produces « <text/> » nodes (bad).

I can manage it without the a_indent option.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: ftest.5.11e.xdp
Type: application/vnd.adobe.xdp+xml
Size: 1455 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20071219/017ddc63/ftest.5.11e.bin

More information about the Haskell-Cafe mailing list