
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,

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. Thanks/спасибо Fernand

Hmmm, with 'readString ... "<this> </this>"' everything works fine, but with 'readString ... "<items><this> </this></items>"' it doesn't. Seems to be a bug in HXT.
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).

Hi Miguel,
Hmmm, with 'readString ... "<this> </this>"' everything works fine, but with 'readString ... "<items><this> </this></items>"' it doesn't. Seems to be a bug in HXT.
I don't see the bug: ------------------------------------------ *Main> runX $ ( readString [(a_validate,v_0)] "<items><this> </this></items>" >>> setTraceLevel 4 >>> traceDoc "doc after reading" >>> setTraceLevel 0 >>> writeDocumentToString []) -- (1) doc after reading <items> <this/> </items> content of: "<items><this> </this></items>" =========================================== ---XTag "/" | "source"="\"<items><this> </this></items>\"" | "encoding"="UNICODE" | "transfer-URI"="string:" | "transfer-Message"="OK" | "transfer-Status"="200" | "transfer-Encoding"="UNICODE" | +---XTag "items" | +---XTag "this" | +---XText " " ["<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<items><this> </this></items>"] *Main> ----------------------------------------- the space remains there and not element with empty contents occurs Cheers, Uwe -- Web: http://www.fh-wedel.de/~si/
participants (3)
-
Fernand
-
Miguel Mitrofanov
-
Uwe Schmidt