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
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
Thank you Christian, changing the argument order does help indeed with the whitespace! The documentation is slightly vague about this.
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. For example if I use the same operation in Oxygen, not omitting the declaration is the default behaviour in Saxon EE.
But with BaseX, while I could use fn:put() with a map of serialisation parameters in the return statement, this does not help much because I can not use BaseX functions in my script :-( Is changing this (default) outside the scope of an update script not possible?
BTW I noticed some strange behaviour (this is possibly a bug?) - when CHOP=false in the .basex file and -w switch not set, whitespace does not get chopped (expected) - when CHOP=false in the .basex file and -w switch on the command line, whitespace gets chopped (not expected!)
Thanks, Daniel
-----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
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
I already tried setting serialization params in .basex, per command line switch and as declare variable. Any serialization parameter gets ignored from the command line with XQuery Update.
I found an ancient report about this behaviour in the archives, but no solution: https://mailman.uni-konstanz.de/pipermail/basex-talk/2011-May/001593.html
Has this been solved? Is this a bug?
What does work is using fn:put() with writing to document-uri() and supplying a serialization map as third parameter. Unfortunately, for unknown reasons Saxon fails with a third parameter for fn:put(), even with XQuery 3.1 enabled (the BaseX implementation seems more correct after reading the specification). Right now, I would need a variant when I want to run my script in both BaseX commandline and Oxygen with Saxon EE.
Daniel
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen@gmail.com] Gesendet: Mittwoch, 12. Dezember 2018 17:04 An: Zimmel, Daniel Cc: BaseX Betreff: Re: [basex-talk] Command line options not working with update operation on input file
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
Any serialization parameter gets ignored from the command line with XQuery Update.
Has this been solved? Is this a bug?
XML declarations are never stored in the database. Instead, they will be added during serialization. So I’m not exactly on what you just tried to do. Could you please give some step-by-step instructions?
…I think I got what you were trying to achieve! There is a separate option for exporting databases and writing updates. This may be more obvious now after another updates of our documentation [1].
Here is a little self-contained BaseX call that (as I hope) demonstrates the behavior:
basex -u -c"set exporter omit-xml-declaration=no" "file:write('doc.xml', <a/>)" "insert node <b/> into doc('doc.xml')/*" "fetch:xml('doc.xml')"
<?xml version="1.0" encoding="UTF-8"?> <a> <b/> </a>
You can also run the following command script ("basex script.bxs"):
set exporter omit-xml-declaration=no set writeback on xquery file:write('doc.xml', <a/>) xquery insert node <a/> into doc('doc.xml')/* xquery fetch:xml('doc.xml')
Maybe we’ll merge these two options in a future release of BaseX. Until then, just add an EXPORTER option to your .basex file with the identical serialization parameters.
Best Christian
[1] http://docs.basex.org/wiki/Options#WRITEBACK
On Wed, Dec 12, 2018 at 6:35 PM Christian Grün christian.gruen@gmail.com wrote:
Any serialization parameter gets ignored from the command line with XQuery Update.
Has this been solved? Is this a bug?
XML declarations are never stored in the database. Instead, they will be added during serialization. So I’m not exactly on what you just tried to do. Could you please give some step-by-step instructions?
Ah, now this makes it much more clear in the documentation, I just checked the wiki page history.
The only thing is I prefer the Saxon default about not changing anything on already existing indentation (BaseX is deleting any indentation with indent=no), but I am aware this is implementation-defined.
Thanks for the update, Daniel
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen@gmail.com] Gesendet: Mittwoch, 12. Dezember 2018 18:47 An: Zimmel, Daniel Cc: BaseX Betreff: Re: [basex-talk] Command line options not working with update operation on input file
…I think I got what you were trying to achieve! There is a separate option for exporting databases and writing updates. This may be more obvious now after another updates of our documentation [1].
Here is a little self-contained BaseX call that (as I hope) demonstrates the behavior:
basex -u -c"set exporter omit-xml-declaration=no" "file:write('doc.xml', <a/>)" "insert node <b/> into doc('doc.xml')/*" "fetch:xml('doc.xml')"
<?xml version="1.0" encoding="UTF-8"?>
<a> <b/> </a>
You can also run the following command script ("basex script.bxs"):
set exporter omit-xml-declaration=no set writeback on xquery file:write('doc.xml', <a/>) xquery insert node <a/> into doc('doc.xml')/* xquery fetch:xml('doc.xml')
Maybe we’ll merge these two options in a future release of BaseX. Until then, just add an EXPORTER option to your .basex file with the identical serialization parameters.
Best Christian
[1] http://docs.basex.org/wiki/Options#WRITEBACK
On Wed, Dec 12, 2018 at 6:35 PM Christian Grün christian.gruen@gmail.com wrote:
Any serialization parameter gets ignored from the command line with XQuery
Update.
Has this been solved? Is this a bug?
XML declarations are never stored in the database. Instead, they will be added during serialization. So I’m not exactly on what you just tried to do. Could you please give some step-by-step instructions?
The only thing is I prefer the Saxon default about not changing anything on already existing indentation (BaseX is deleting any indentation with indent=no), but I am aware this is implementation-defined.
Existing identation is actually preserved by both BaseX and Saxon:
declare namespace output = 'http://www.w3.org/2010/xslt-xquery-serialization'; declare option output:indent 'no'; parse-xml('<a> <b/> </a>')
Were you referring to documents with chopped whitespaces?
Cheers Christian
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen@gmail.com] Gesendet: Mittwoch, 12. Dezember 2018 18:47 An: Zimmel, Daniel Cc: BaseX Betreff: Re: [basex-talk] Command line options not working with update operation on input file
…I think I got what you were trying to achieve! There is a separate option for exporting databases and writing updates. This may be more obvious now after another updates of our documentation [1].
Here is a little self-contained BaseX call that (as I hope) demonstrates the behavior:
basex -u -c"set exporter omit-xml-declaration=no" "file:write('doc.xml', <a/>)" "insert node <b/> into doc('doc.xml')/*" "fetch:xml('doc.xml')"
<?xml version="1.0" encoding="UTF-8"?>
<a> <b/> </a>
You can also run the following command script ("basex script.bxs"):
set exporter omit-xml-declaration=no set writeback on xquery file:write('doc.xml', <a/>) xquery insert node <a/> into doc('doc.xml')/* xquery fetch:xml('doc.xml')
Maybe we’ll merge these two options in a future release of BaseX. Until then, just add an EXPORTER option to your .basex file with the identical serialization parameters.
Best Christian
[1] http://docs.basex.org/wiki/Options#WRITEBACK
On Wed, Dec 12, 2018 at 6:35 PM Christian Grün christian.gruen@gmail.com wrote:
Any serialization parameter gets ignored from the command line with XQuery
Update.
Has this been solved? Is this a bug?
XML declarations are never stored in the database. Instead, they will be added during serialization. So I’m not exactly on what you just tried to do. Could you please give some step-by-step instructions?
I was referring to XQuery update writeback, chop option is set to false:
$ basex.bat -u -w -c"set exporter omit-xml-declaration=no,indent=no" -itest.xml update.xquery
update.xquery:
for $c in doc(document-uri())//kennung return (replace value of node $c with "REPLACED")
test.xml:
<?xml version="1.0" encoding="UTF-8"?> <root><vs> <kennung>test</kennung> <absatz> <fett>eins</fett> </absatz> </vs> </root>
Result
<?xml version="1.0" encoding="UTF-8"?> <root><vs><kennung>REPLACED</kennung><absatz><fett>eins</fett></absatz><absatz>Test<fett>fett</fett><kursiv>kursiv</kursiv>Text z.B. am 01.02.2018 Text.</absatz></vs></root>
Saxon does not change indentation (with declare option saxon:output "indent=no")
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen@gmail.com] Gesendet: Donnerstag, 13. Dezember 2018 12:41 An: Zimmel, Daniel Cc: BaseX Betreff: Re: [basex-talk] Command line options not working with update operation on input file
The only thing is I prefer the Saxon default about not changing anything on
already existing indentation (BaseX is deleting any indentation with indent=no), but I am aware this is implementation-defined.
Existing identation is actually preserved by both BaseX and Saxon:
declare namespace output = 'http://www.w3.org/2010/xslt-xquery-serialization'; declare option output:indent 'no'; parse-xml('<a> <b/> </a>')
Were you referring to documents with chopped whitespaces?
Cheers Christian
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen@gmail.com] Gesendet: Mittwoch, 12. Dezember 2018 18:47 An: Zimmel, Daniel Cc: BaseX Betreff: Re: [basex-talk] Command line options not working with update
operation
on input file
…I think I got what you were trying to achieve! There is a separate option for exporting databases and writing updates. This may be more obvious now after another updates of our documentation [1].
Here is a little self-contained BaseX call that (as I hope) demonstrates the behavior:
basex -u -c"set exporter omit-xml-declaration=no" "file:write('doc.xml', <a/>)" "insert node <b/> into doc('doc.xml')/*" "fetch:xml('doc.xml')"
<?xml version="1.0" encoding="UTF-8"?>
<a> <b/> </a>
You can also run the following command script ("basex script.bxs"):
set exporter omit-xml-declaration=no set writeback on xquery file:write('doc.xml', <a/>) xquery insert node <a/> into doc('doc.xml')/* xquery fetch:xml('doc.xml')
Maybe we’ll merge these two options in a future release of BaseX. Until then, just add an EXPORTER option to your .basex file with the identical serialization parameters.
Best Christian
[1] http://docs.basex.org/wiki/Options#WRITEBACK
On Wed, Dec 12, 2018 at 6:35 PM Christian Grün christian.gruen@gmail.com wrote:
Any serialization parameter gets ignored from the command line with
XQuery
Update.
Has this been solved? Is this a bug?
XML declarations are never stored in the database. Instead, they will be added during serialization. So I’m not exactly on what you just tried to do. Could you please give some step-by-step instructions?
This is what I get:
<?xml version="1.0" encoding="UTF-8"?> <root><vs> <kennung>REPLACED</kennung> <absatz> <fett>eins</fett> </absatz> </vs> </root>
Do you possibly have some settings in your .basex configuration file that I should consider? Or do you have a 'test' database with chopped whitespaces that is opened instead of your test.xml document?
On Thu, Dec 13, 2018 at 1:43 PM Zimmel, Daniel D.Zimmel@esvmedien.de wrote:
I was referring to XQuery update writeback, chop option is set to false:
$ basex.bat -u -w -c"set exporter omit-xml-declaration=no,indent=no" -itest.xml update.xquery
update.xquery:
for $c in doc(document-uri())//kennung return (replace value of node $c with "REPLACED")
test.xml:
<?xml version="1.0" encoding="UTF-8"?>
<root><vs> <kennung>test</kennung> <absatz> <fett>eins</fett> </absatz>
</vs> </root>
Result
<?xml version="1.0" encoding="UTF-8"?>
<root><vs><kennung>REPLACED</kennung><absatz><fett>eins</fett></absatz><absatz>Test<fett>fett</fett><kursiv>kursiv</kursiv>Text z.B. am 01.02.2018 Text.</absatz></vs></root>
Saxon does not change indentation (with declare option saxon:output "indent=no")
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen@gmail.com] Gesendet: Donnerstag, 13. Dezember 2018 12:41 An: Zimmel, Daniel Cc: BaseX Betreff: Re: [basex-talk] Command line options not working with update operation on input file
The only thing is I prefer the Saxon default about not changing anything on
already existing indentation (BaseX is deleting any indentation with indent=no), but I am aware this is implementation-defined.
Existing identation is actually preserved by both BaseX and Saxon:
declare namespace output = 'http://www.w3.org/2010/xslt-xquery-serialization'; declare option output:indent 'no'; parse-xml('<a> <b/> </a>')
Were you referring to documents with chopped whitespaces?
Cheers Christian
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen@gmail.com] Gesendet: Mittwoch, 12. Dezember 2018 18:47 An: Zimmel, Daniel Cc: BaseX Betreff: Re: [basex-talk] Command line options not working with update
operation
on input file
…I think I got what you were trying to achieve! There is a separate option for exporting databases and writing updates. This may be more obvious now after another updates of our documentation [1].
Here is a little self-contained BaseX call that (as I hope) demonstrates the behavior:
basex -u -c"set exporter omit-xml-declaration=no" "file:write('doc.xml', <a/>)" "insert node <b/> into doc('doc.xml')/*" "fetch:xml('doc.xml')"
<?xml version="1.0" encoding="UTF-8"?>
<a> <b/> </a>
You can also run the following command script ("basex script.bxs"):
set exporter omit-xml-declaration=no set writeback on xquery file:write('doc.xml', <a/>) xquery insert node <a/> into doc('doc.xml')/* xquery fetch:xml('doc.xml')
Maybe we’ll merge these two options in a future release of BaseX. Until then, just add an EXPORTER option to your .basex file with the identical serialization parameters.
Best Christian
[1] http://docs.basex.org/wiki/Options#WRITEBACK
On Wed, Dec 12, 2018 at 6:35 PM Christian Grün christian.gruen@gmail.com wrote:
Any serialization parameter gets ignored from the command line with
XQuery
Update.
Has this been solved? Is this a bug?
XML declarations are never stored in the database. Instead, they will be added during serialization. So I’m not exactly on what you just tried to do. Could you please give some step-by-step instructions?
Thanks for the hint. Yes, in my .basex there is a CHOP=false; when I delete it, it works as expected.
But as I pointed out, this looks like a bug to me:
With the same query, when CHOP=false in the .basex file and -w switch on the command line, whitespace gets chopped (not expected!)
Input
<root><vs> <kennung>TTT</kennung> <absatz><fett>eins</fett> und <fett>zwei</fett> </absatz> </vs> </root>
.basex:
CHOP=false
Result
<?xml version="1.0" encoding="UTF-8"?> <root><vs><kennung>TTT</kennung><absatz><fett>eins</fett>und<fett>zwei</fett></absatz></vs></root>
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen@gmail.com] Gesendet: Donnerstag, 13. Dezember 2018 13:49 An: Zimmel, Daniel Cc: BaseX Betreff: Re: [basex-talk] Command line options not working with update operation on input file
This is what I get:
<?xml version="1.0" encoding="UTF-8"?>
<root><vs> <kennung>REPLACED</kennung> <absatz> <fett>eins</fett> </absatz>
</vs> </root>
Do you possibly have some settings in your .basex configuration file that I should consider? Or do you have a 'test' database with chopped whitespaces that is opened instead of your test.xml document?
On Thu, Dec 13, 2018 at 1:43 PM Zimmel, Daniel D.Zimmel@esvmedien.de wrote:
I was referring to XQuery update writeback, chop option is set to false:
$ basex.bat -u -w -c"set exporter omit-xml-declaration=no,indent=no" -itest.xml
update.xquery
update.xquery:
for $c in doc(document-uri())//kennung return (replace value of node $c with "REPLACED")
test.xml:
<?xml version="1.0" encoding="UTF-8"?>
<root><vs> <kennung>test</kennung> <absatz> <fett>eins</fett> </absatz>
</vs> </root>
Result
<?xml version="1.0" encoding="UTF-8"?>
<root><vs><kennung>REPLACED</kennung><absatz><fett>eins</fett></absatz
<absatz>Test<fett>fett</fett><kursiv>kursiv</kursiv>Text z.B. am 01.02.2018
Text.</absatz></vs></root>
Saxon does not change indentation (with declare option saxon:output
"indent=no")
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen@gmail.com] Gesendet: Donnerstag, 13. Dezember 2018 12:41 An: Zimmel, Daniel Cc: BaseX Betreff: Re: [basex-talk] Command line options not working with update
operation
on input file
The only thing is I prefer the Saxon default about not changing anything on
already existing indentation (BaseX is deleting any indentation with
indent=no),
but I am aware this is implementation-defined.
Existing identation is actually preserved by both BaseX and Saxon:
declare namespace output = 'http://www.w3.org/2010/xslt-xquery-
serialization';
declare option output:indent 'no'; parse-xml('<a> <b/> </a>')
Were you referring to documents with chopped whitespaces?
Cheers Christian
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen@gmail.com] Gesendet: Mittwoch, 12. Dezember 2018 18:47 An: Zimmel, Daniel Cc: BaseX Betreff: Re: [basex-talk] Command line options not working with update
operation
on input file
…I think I got what you were trying to achieve! There is a separate option for exporting databases and writing updates. This may be more obvious now after another updates of our documentation [1].
Here is a little self-contained BaseX call that (as I hope) demonstrates the behavior:
basex -u -c"set exporter omit-xml-declaration=no" "file:write('doc.xml', <a/>)" "insert node <b/> into doc('doc.xml')/*" "fetch:xml('doc.xml')"
<?xml version="1.0" encoding="UTF-8"?>
<a> <b/> </a>
You can also run the following command script ("basex script.bxs"):
set exporter omit-xml-declaration=no set writeback on xquery file:write('doc.xml', <a/>) xquery insert node <a/> into doc('doc.xml')/* xquery fetch:xml('doc.xml')
Maybe we’ll merge these two options in a future release of BaseX. Until then, just add an EXPORTER option to your .basex file with the identical serialization parameters.
Best Christian
[1] http://docs.basex.org/wiki/Options#WRITEBACK
On Wed, Dec 12, 2018 at 6:35 PM Christian Grün christian.gruen@gmail.com wrote:
> Any serialization parameter gets ignored from the command line with
XQuery
Update.
> > Has this been solved? Is this a bug?
XML declarations are never stored in the database. Instead, they will be added during serialization. So I’m not exactly on what you just tried to do. Could you please give some step-by-step instructions?
With the same query, when CHOP=false in the .basex file and -w switch on the command line, whitespace gets chopped (not expected!)
The option is toggled (see one of my previous replies). We should revise the help text on the command-line in a future version.
Looks like I was not getting the toggle part correctly. Yes it is very confusing since it says:
"-w Preserve whitespaces from input files"
Thanks! I will toggle this now in my internal documentation :-)
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen@gmail.com] Gesendet: Donnerstag, 13. Dezember 2018 14:26 An: Zimmel, Daniel Cc: BaseX Betreff: Re: [basex-talk] Command line options not working with update operation on input file
With the same query, when CHOP=false in the .basex file and -w switch on the
command line, whitespace gets chopped (not expected!)
The option is toggled (see one of my previous replies). We should revise the help text on the command-line in a future version.
True, the documentation of the command-line flags hasn’t been updated for quite a while now. I’ve just caught up on that. BaseX 9.1.1 is scheduled for tomorrow, it will include the updated help texts.
On Thu, Dec 13, 2018 at 2:32 PM Zimmel, Daniel D.Zimmel@esvmedien.de wrote:
Looks like I was not getting the toggle part correctly. Yes it is very confusing since it says:
"-w Preserve whitespaces from input files"
Thanks! I will toggle this now in my internal documentation :-)
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen@gmail.com] Gesendet: Donnerstag, 13. Dezember 2018 14:26 An: Zimmel, Daniel Cc: BaseX Betreff: Re: [basex-talk] Command line options not working with update operation on input file
With the same query, when CHOP=false in the .basex file and -w switch on the
command line, whitespace gets chopped (not expected!)
The option is toggled (see one of my previous replies). We should revise the help text on the command-line in a future version.
basex-talk@mailman.uni-konstanz.de