It seems globally setting `indent=no` gets applied to WebDAV (and everywhere else where serialization is not explicit specified). This would be my preference for WebDAV, as it means documents can be round-tripped without any changes being introduced. The only side effect from this setting I have seen is view-source on generated html source is harder to read, but this is not a real issue.
I have not tried setting them in web.xml yet. I wondered if you would expect it to work :-). I will try... Cheers /Andy On 10 August 2017 at 18:40, Christian Grün <christian.gr...@gmail.com> wrote: > Hi Andy, > > > Can the WebDAV serialization be set independently of the default, in > > web.xml? > > The defaults for whitespace chopping and serialization can only be > assigned globally for all features of BaseX. Did you try to set both > 'org.basex.chop' and 'org.basex.serializer' in web.xml / does it > introduce other unwanted side effects? > > Cheers, > Christian > > > > /Andy > > > > On 7 August 2017 at 09:57, Christian Grün <christian.gr...@gmail.com> > wrote: > >> > >> Dear Ottid, > >> > >> Thanks for providing us with the helpful example, which helped me to > >> understand the problem. > >> > >> >> replace /a <root xml:space="preserve"><a><b>foo</b></a> bar</root> > >> > "a.xml" (Line 1): Open quote is expected for attribute "xml:space" > >> > associated with an element type "root". > >> > >> Just a side note: Command-line parsing is restrictive when it comes to > >> replacing XML. The reason is that is possible to send multiple > >> commands in a single line, as shown in the following example: > >> > >> create db db; replace /a <a/>; xquery . > >> > >> > >> >> xquery /root > >> > <root><a><b>foo</b></a> bar</root> > >> > >> You may be surprised to hear that whitespaces in your document were > >> actually chopped, and that the whitespaces are added by the > >> serializer, because the "indent" serialization parameter is by default > >> set to "yes". > >> > >> It was surprised to see that no one else pointed at this so far, and > >> that was not mentioned in our documentation, so I have just added some > >> explanatory lines [1,2]. > >> > >> Some more technical background: > >> > >> If you call BaseX the "info storage" command, you will see which XML > >> nodes are stored in the document: > >> > >> > set chop on;create db db <a> </a>; info storage > >> CHOP: true > >> Database 'db' created in 11.0 ms. > >> PRE DIS SIZ ATS ID NS KIND CONTENT > >> ----------------------------------------- > >> 0 1 2 1 0 0 DOC db.xml > >> 1 1 1 1 1 0 ELEM aIf > >> > >> > set chop off;create db db <a> </a>; info storage > >> CHOP: false > >> Database 'db' created in 20.12 ms. > >> PRE DIS SIZ ATS ID NS KIND CONTENT > >> ----------------------------------------- > >> 0 1 3 1 0 0 DOC db.xml > >> 1 1 2 1 1 0 ELEM a > >> 2 1 1 1 2 0 TEXT > >> > >> Serialization indentation was a chosen as default because it goes hand > >> in hand with the CHOP option. It even works fine if CHOP is disabled > >> if a document has whitespaces included (in which case no whitespaces > >> will be added by the serialized). But it may definitely cause > >> undesirable output if a document contains no superfluous whitespaces, > >> such as in your case. > >> > >> Hope this helps, > >> Christian > >> > >>  http://docs.basex.org/wiki/Options#CHOP > >>  http://docs.basex.org/wiki/Full-Text#Mixed_Content > > > > >