"CG" == Christian Grün christian.gruen@gmail.com writes:
CG> However, you may want to use the -w flag to preserve the original CG> document whitespaces and newlines.
I would have never guessed from the man page, which just mentions input, not output:
-w By default, whitespaces around text nodes are chopped when a database is created. The flag specifies to suppress chopping.
Nor is -w mentioned on http://docs.basex.org/wiki/Serialization
Yes it turns out -w is what I want.
$ basex -q 'doc("u.xml")' <W> <X>AA AA</X> <X>BB BB</X> <X>CC CC</X> <X>DD DD</X> </W>$ basex -q 'doc("u.xml")'; echo <-------note the echo needed to add the missing newline [BUG]. <W> <X>AA AA</X> <X>BB BB</X> <X>CC CC</X> <X>DD DD</X> </W> $ basex -w -s method=text -q 'doc("u.xml")'
AA AA BB BB CC CC DD DD $ basex -w -s method=text -q 'doc("u.xml")'|sed 's/^ +//;/^$/d' #OK, this is what I want. Thanks. AA AA BB BB CC CC DD DD