Hi Daniel,
Unfortunately, I still have not found a way to force BaseX NOT to delete my xml declaration with any update operation on a given input file.
The XML declaration is a part of the serialization process. You can enable it by adding…
SERIALIZER=omit-xml-declaration=no,indent=no
…to your .basex configuration file. I have added indent=no, as this is usually the best option when preserving whitespaces.
- when CHOP=false in the .basex file and -w switch on the command line, whitespace gets chopped (not expected!)
The command-line help should probably be revised. With -w, the value of the option is actually toggled. I have updated our documentation to make this more obvious [1]. You can use -v to see which value will be assigned.
Best, Christian
[1] http://docs.basex.org/wiki/Command-Line_Options
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen@gmail.com] Gesendet: Freitag, 7. Dezember 2018 17:41 An: Zimmel, Daniel Cc: BaseX Betreff: Re: [basex-talk] Command line options not working with update operation on input file
Hi Daniel.
The argument order is important in BaseX; you could try the following variant:
basex.bat -u -w -ifile.xml -sindent=no update.xquery
If this doesn’t help, you could append the CHOP=true in your .basex configuration file.
Hope this helps Christian
On Fri, Dec 7, 2018 at 3:40 PM Zimmel, Daniel D.Zimmel@esvmedien.de wrote:
Hello,
can anyone give me a hint on the behaviour of the command line options in
BaseX 9.0.2?
When I try an update operation on a file given with "-i", neither the option "-w"
nor any serialisation option gets evaluated; while the update operation with "-u" is working correctly, my whitespace gets happily chopped.
CCL: $ basex.bat -ifile.xml -sindent=no -u -w update.xquery XQ: for $c in doc(document-uri())//element return replace value of node $c with "TEST"
A workaround is using fetch:xml() with document-uri(), which does leave any
whitespace intact and does no indentation (no parameters necessary).
declare variable $doc := document-uri(); for $c in fetch:xml($doc)//element return replace value of node $c with "TEST"
Unfortunately my requirement is I cannot use specific BaseX-functions in this
specific update script.
My XML:
<root> <vs> <kennung>Kennung</kennung> <absatz> <fett>eins</fett> </absatz> <absatz id="sgb04_k_para067_p67_a0001_a0001"> Test <fett>fett</fett>
<kursiv>kursiv</kursiv> Text Text.</absatz>
</vs> </root>
Thanks, Daniel