Hi Jos,
Whitespaces will be preserved if the CHOP option is disabled. You can make this a default by adding CHOP=false in your .basex configuration file [1,2].
Hope this helps, Christian
[1] https://docs.basex.org/wiki/Full-Text#Mixed_Content [2] https://docs.basex.org/wiki/Configuration
Jos van den Oever jos@vandenoever.info schrieb am Di., 16. Feb. 2021, 22:00:
Dear all,
First off: BaseX is great to work with. I use it for a few statically generated websites.
But I recently found what might be a bug.
Some whitespace vanishes when loading xml files. E.g. this xml file:
<a> a b <a> c </a> d e </a>
run like this:
doc('test.xml')
gives:
<a>a b<a>c</a>d e</a>
But running this:
parse-xml('<a> a b <a> c </a> d e </a>')
retains the whitespace.
I've tested this with BaseX 7.0, 8.0, 9.0 and 9.4.6.
Running this in saxon-he-10.3.jar retains the whitespace.
I can work around this issue by placing xml:space="preserve" in the document element.
I cannot come up with a scenario in which discarding whitespace during is parsing is ok when no DTD or XML Schema is provided.
Best regards, Jos