Hi Jidanni,
thanks for your feedback, this is just a guess, but did you try to set chopping to false?
declare option db:chop 'false';
doc('tmp/doc.xml')
http://docs.basex.org/wiki/Options#CHOP tells you what it does:
Chops all leading and trailing whitespaces from text nodes while building a database, and discards empty text nodes. By default, this option is set to true, as it often reduces the database size by up to 50%. It can also be turned off on command line via -w.
As chopping does not change any semantics (at least with regards to what XML thinks of semantically important) but only aesthetics this is enabled by default.
Hope this helps.
Best Michael
Am 05.04.2013 um 06:02 schrieb jidanni@jidanni.org:
Pardon me but basex 7.6 doc() function is out of control.
$ more ib.xml z.xq|cat :::::::::::::: ib.xml ::::::::::::::
<Z> <P>There should be a space: <!-- --> :here!</P> <P>There should be a space:<!-- --> :here!</P> <P>There should be a space: <!-- -->:here!</P> <P>There should be a space: <!-- --> :here!</P> <P>There should be a space: <!-- --> :here!</P> <P>There should be a space: <!-- --> :here!</P> <P>There should be a space: <!-- --> <!-- --> :here!</P> <P>There should be NO SPACE:<!-- --><!-- -->:here!</P> <P>There should be NO SPACE:<!-- -->:<!-- -->:here!</P> </Z> :::::::::::::: z.xq :::::::::::::: doc("ib.xml") $ basex z.xq <Z> <P>There should be a space:<!-- -->:here!</P> <P>There should be a space:<!-- -->:here!</P> <P>There should be a space:<!-- -->:here!</P> <P>There should be a space:<!-- -->:here!</P> <P>There should be a space:<!-- -->:here!</P> <P>There should be a space:<!-- -->:here!</P> <P>There should be a space:<!-- --> <!-- -->:here!</P> <P>There should be NO SPACE:<!-- --> <!-- -->:here!</P> <P>There should be NO SPACE:<!-- -->:<!-- -->:here!</P> </Z>$ basex z.xq|w3m -dump -T text/html There should be a space::here!
There should be a space::here!
There should be a space::here!
There should be a space::here!
There should be a space::here!
There should be a space::here!
There should be a space: :here!
There should be NO SPACE: :here!
There should be NO SPACE:::here!
So it failed all but two. The problem seems to lie in the doc() function.
In fact if you just left what you found intact, you wouldn't wreck people's formatting too. You don't wreck things when processing let $k := <coordinates> 120.867029,24.167269,10 <!--1 G8247 AC66--> 120.866931,24.167630,10 <!--2 G8247 AD50--> 120.866832,24.167901,10 <!--3 G8247 AD43--> </coordinates>
then why not do the same with doc()? _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk