I'm trying to do an update operation on a file using standalone cmdline basex.
The xml-declaration get printed to stdout instead of to the updated file.
$cat test.xml <?xml version="1.0" encoding="UTF-8"?> <root> <test/> </root>
$cat test.xq declare option output:omit-xml-declaration "no";
let $root := doc("test.xml")/root return insert node <test/> into $root
$basex -u test.xq
$cat test.xml <root> <test/> <test/> </root>
The declaration gets removed :<
Hi David,
the following query does what you trying to do (i guess):
declare option output:omit-xml-declaration "no"; put( copy $doc := doc("test.xml") modify insert node <testnew/> into $doc/root return $doc, "test2.xml")
Kind regards, Andreas
On 10.05.2011, at 07:11, David Reichle wrote:
I'm trying to do an update operation on a file using standalone cmdline basex.
The xml-declaration get printed to stdout instead of to the updated file.
$cat test.xml
<?xml version="1.0" encoding="UTF-8"?>
<root> <test/> </root>
$cat test.xq declare option output:omit-xml-declaration "no";
let $root := doc("test.xml")/root return insert node <test/> into $root
$basex -u test.xq
$cat test.xml
<root> <test/> <test/> </root>
The declaration gets removed :<
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
I'm sorry; I wasn't really _trying_ to do anything, except to point out what I consider a bug. Thank-you for your reply.
On Tue, May 10, 2011 at 5:27 AM, Andreas Weiler < andreas.weiler@uni-konstanz.de> wrote:
Hi David,
the following query does what you trying to do (i guess):
declare option output:omit-xml-declaration "no"; put( copy $doc := doc("test.xml") modify insert node <testnew/> into $doc/root return $doc, "test2.xml")
Kind regards, Andreas
On 10.05.2011, at 07:11, David Reichle wrote:
I'm trying to do an update operation on a file using standalone cmdline
basex.
The xml-declaration get printed to stdout instead of to the updated file.
$cat test.xml
<?xml version="1.0" encoding="UTF-8"?>
<root> <test/> </root>
$cat test.xq declare option output:omit-xml-declaration "no";
let $root := doc("test.xml")/root return insert node <test/> into $root
$basex -u test.xq
$cat test.xml
<root> <test/> <test/> </root>
The declaration gets removed :<
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Dear David,
thanks, all observations on potential bugs are welcome. In this case, the behavior is indeed expected (although somewhat counterintuitive): When the document is serialized to disk, we have already lost the information if an XML declaration was specified. Other information, such as DTD declarations and entities, are lost as well as long as they are not explicitly specified as serialization parameters.
Best, Christian ___________________________
On Thu, May 12, 2011 at 6:24 AM, David Reichle dreichle@cableone.net wrote:
I'm sorry; I wasn't really _trying_ to do anything, except to point out what I consider a bug. Thank-you for your reply.
On Tue, May 10, 2011 at 5:27 AM, Andreas Weiler andreas.weiler@uni-konstanz.de wrote:
Hi David,
the following query does what you trying to do (i guess):
declare option output:omit-xml-declaration "no"; put( copy $doc := doc("test.xml") modify insert node <testnew/> into $doc/root return $doc, "test2.xml")
Kind regards, Andreas
On 10.05.2011, at 07:11, David Reichle wrote:
I'm trying to do an update operation on a file using standalone cmdline basex.
The xml-declaration get printed to stdout instead of to the updated file.
$cat test.xml
<?xml version="1.0" encoding="UTF-8"?>
<root> <test/> </root>
$cat test.xq declare option output:omit-xml-declaration "no";
let $root := doc("test.xml")/root return insert node <test/> into $root
$basex -u test.xq
$cat test.xml
<root> <test/> <test/> </root>
The declaration gets removed :<
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
The serialization parameter 'omit-xml-declaration' is being specified. I ran the following test with basex and mxquery to compare the behavior.
$ $ cat test.xq let $root := doc("test.xml")/root return insert node <test/> into $root $ $ echo "<root/>" > test.xml $ java -jar mxquery.jar -um -x -s omit-xml-declaration=no -f test.xq May 12, 2011 9:40:33 PM ch.ethz.mxquery.cmdline.MXQuery executeQuery WARNING: Logger started May 12, 2011 9:40:33 PM ch.ethz.mxquery.util.Logger log INFO: Parsing completed, took 24 ms <?xml version='1.0' encoding='UTF-8' ?>$ $ $ cat test.xml <?xml version='1.0' encoding='UTF-8' ?><root><test/></root>$ $ $ echo "<root/>" > test.xml $ $ basex -s omit-xml-declaration=no -u test.xq <?xml version="1.0" encoding="UTF-8"?>$ $ $ cat test.xml <root> <test/> </root>$ $ $
You can see that mxquery also prints the declaration to stdout like basex but also inserts it into the updated serialized test.xml. I haven't tried any other processors but the behavior of mxquery is what I would expect. I looked but didn't see anything in the XQuery Update Facility specification about serialization behavior.
David
On Thu, May 12, 2011 at 1:57 AM, Christian Grün christian.gruen@gmail.comwrote:
Dear David,
thanks, all observations on potential bugs are welcome. In this case, the behavior is indeed expected (although somewhat counterintuitive): When the document is serialized to disk, we have already lost the information if an XML declaration was specified. Other information, such as DTD declarations and entities, are lost as well as long as they are not explicitly specified as serialization parameters.
Best, Christian ___________________________
On Thu, May 12, 2011 at 6:24 AM, David Reichle dreichle@cableone.net wrote:
I'm sorry; I wasn't really _trying_ to do anything, except to point out
what
I consider a bug. Thank-you for your reply.
On Tue, May 10, 2011 at 5:27 AM, Andreas Weiler andreas.weiler@uni-konstanz.de wrote:
Hi David,
the following query does what you trying to do (i guess):
declare option output:omit-xml-declaration "no"; put( copy $doc := doc("test.xml") modify insert node <testnew/> into $doc/root return $doc, "test2.xml")
Kind regards, Andreas
On 10.05.2011, at 07:11, David Reichle wrote:
I'm trying to do an update operation on a file using standalone
cmdline
basex.
The xml-declaration get printed to stdout instead of to the updated file.
$cat test.xml
<?xml version="1.0" encoding="UTF-8"?>
<root> <test/> </root>
$cat test.xq declare option output:omit-xml-declaration "no";
let $root := doc("test.xml")/root return insert node <test/> into $root
$basex -u test.xq
$cat test.xml
<root> <test/> <test/> </root>
The declaration gets removed :<
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
This behavior is implementation-defined. mxquery will always add an xml declaration to the result, no matter if it has been specified before.
Christian Am 13.05.2011 06:15 schrieb "David Reichle" dreichle@cableone.net:
The serialization parameter 'omit-xml-declaration' is being specified. I ran the following test with basex and mxquery to compare the behavior.
$ $ cat test.xq let $root := doc("test.xml")/root return insert node <test/> into $root $ $ echo "<root/>" > test.xml $ java -jar mxquery.jar -um -x -s omit-xml-declaration=no -f test.xq May 12, 2011 9:40:33 PM ch.ethz.mxquery.cmdline.MXQuery executeQuery WARNING: Logger started May 12, 2011 9:40:33 PM ch.ethz.mxquery.util.Logger log INFO: Parsing completed, took 24 ms
<?xml version='1.0' encoding='UTF-8' ?>$
$ $ cat test.xml
<?xml version='1.0' encoding='UTF-8' ?><root><test/></root>$
$ $ echo "<root/>" > test.xml $ $ basex -s omit-xml-declaration=no -u test.xq
<?xml version="1.0" encoding="UTF-8"?>$
$ $ cat test.xml
<root> <test/> </root>$ $ $
You can see that mxquery also prints the declaration to stdout like basex but also inserts it into the updated serialized test.xml. I haven't tried any other processors but the behavior of mxquery is what I would expect. I looked but didn't see anything in the XQuery Update Facility
specification
about serialization behavior.
David
On Thu, May 12, 2011 at 1:57 AM, Christian Grün christian.gruen@gmail.comwrote:
Dear David,
thanks, all observations on potential bugs are welcome. In this case, the behavior is indeed expected (although somewhat counterintuitive): When the document is serialized to disk, we have already lost the information if an XML declaration was specified. Other information, such as DTD declarations and entities, are lost as well as long as they are not explicitly specified as serialization parameters.
Best, Christian ___________________________
On Thu, May 12, 2011 at 6:24 AM, David Reichle dreichle@cableone.net wrote:
I'm sorry; I wasn't really _trying_ to do anything, except to point out
what
I consider a bug. Thank-you for your reply.
On Tue, May 10, 2011 at 5:27 AM, Andreas Weiler andreas.weiler@uni-konstanz.de wrote:
Hi David,
the following query does what you trying to do (i guess):
declare option output:omit-xml-declaration "no"; put( copy $doc := doc("test.xml") modify insert node <testnew/> into $doc/root return $doc, "test2.xml")
Kind regards, Andreas
On 10.05.2011, at 07:11, David Reichle wrote:
I'm trying to do an update operation on a file using standalone
cmdline
basex.
The xml-declaration get printed to stdout instead of to the updated file.
$cat test.xml
<?xml version="1.0" encoding="UTF-8"?>
<root> <test/> </root>
$cat test.xq declare option output:omit-xml-declaration "no";
let $root := doc("test.xml")/root return insert node <test/> into $root
$basex -u test.xq
$cat test.xml
<root> <test/> <test/> </root>
The declaration gets removed :<
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
basex-talk@mailman.uni-konstanz.de