problem getting -somit-xml-declaration=no to work
Thursday, 6 October 2016 · 5 messages · last reply 7 Oct 2016
RH
Regine I. Heberlein6 Oct 2016 15:59 #
Hello all,
I wonder whether someone could help me with what I'm sure is just some newbie error on my part.
I'm running an XQuery Update using BaseX from the command line over an XML document, and I want the XML declaration to be preserved. My input is:
basex -uVwsomit-xml-declaration=no <input xQuery Update file>
That looks correct to me per the documentation, but when I run it, I lose the XML declaration nevertheless. (The xQuery Update executes correctly.) I've tried the following, all to no avail:
--split out the -s flag, putting it as the first and last flag, respectively --setting the value to "yes" (well, I knew that wasn't going to work, but I had to check, right?) --upper case NO (ditto...)
--adding the following two lines to my xQuery file:
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; declare option output:omit-xml-declaration "no";
I know this question has come up before, but I couldn't find an approach that worked for me in the list archives. Obviously, at this point I'm just throwing darts at the problem. I'd be grateful for any pointers!
Sincerely,
Regine Heberlein
Principal Cataloger and Metadata Analyst, Rare Book Collections Princeton University Library
One Washington Road
Princeton, NJ 08540
609-258-6156
CG
Christian Grün6 Oct 2016 16:35 #
Dear Regine,
Welcome to the list.
Quoted text · Regine I. Heberlein · 3 lines
> I'm running an XQuery Update using BaseX from the command line over an XML document, and I want the XML declaration to be preserved. My input is: > > basex -uVwsomit-xml-declaration=no <input xQuery Update file>
In BaseX, all XML documents are stored without XML declaration.
However, I was surprised indeed that the declaration is not added in your example during serializtion, and I found out that it’s due to our current default serialization method ('basex'), which ignores this option (similar to the 'adaptive' method that has been added with XQuery 3.1 [1]). The following query works:
basex -somit-xml-declaration=no -smethod=xml "<x/>"
I would call this a bug, as it’s not the behavior most people would expect, and we’ll try to fix it soon [2].
Thanks for the report,
Christian
[1] https://www.w3.org/TR/xslt-xquery-serialization-31/#adaptive-output [2] https://github.com/BaseXdb/basex/issues/1369
Quoted text · Regine I. Heberlein · 21 lines
> That looks correct to me per the documentation, but when I run it, I lose the XML declaration nevertheless. (The xQuery Update executes correctly.) I've tried the following, all to no avail: > > --split out the -s flag, putting it as the first and last flag, respectively > --setting the value to "yes" (well, I knew that wasn't going to work, but I had to check, right?) > --upper case NO (ditto...) > --adding the following two lines to my xQuery file: > declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; > declare option output:omit-xml-declaration "no"; > > I know this question has come up before, but I couldn't find an approach that worked for me in the list archives. Obviously, at this point I'm just throwing darts at the problem. I'd be grateful for any pointers! > > Sincerely, > > > Regine Heberlein > Principal Cataloger and Metadata Analyst, Rare Book Collections > Princeton University Library > One Washington Road > Princeton, NJ 08540 > 609-258-6156 >
RH
Regine I. Heberlein6 Oct 2016 17:32 #
Many thanks indeed, Christian!
Regine Heberlein
Principal Cataloger and Metadata Analyst, Rare Book Collections Princeton University Library
One Washington Road
Princeton, NJ 08540
609-258-6156
Quoted text · Christian Grün · 38 lines
-----Original Message----- From: Christian Grün [mailto:christian.gruen at gmail.com] Sent: Thursday, October 06, 2016 10:36 AM To: Regine I. Heberlein Cc: basex-talk at mailman.uni-konstanz.de Subject: Re: [basex-talk] problem getting -somit-xml-declaration=no to work Dear Regine, Welcome to the list. > I'm running an XQuery Update using BaseX from the command line over an XML document, and I want the XML declaration to be preserved. My input is: > > basex -uVwsomit-xml-declaration=no <input xQuery Update file> In BaseX, all XML documents are stored without XML declaration. However, I was surprised indeed that the declaration is not added in your example during serializtion, and I found out that it’s due to our current default serialization method ('basex'), which ignores this option (similar to the 'adaptive' method that has been added with XQuery 3.1 [1]). The following query works: basex -somit-xml-declaration=no -smethod=xml "<x/>" I would call this a bug, as it’s not the behavior most people would expect, and we’ll try to fix it soon [2]. Thanks for the report, Christian [1] https://www.w3.org/TR/xslt-xquery-serialization-31/#adaptive-output [2] https://github.com/BaseXdb/basex/issues/1369 > That looks correct to me per the documentation, but when I run it, I lose the XML declaration nevertheless. (The xQuery Update executes correctly.) I've tried the following, all to no avail: > > --split out the -s flag, putting it as the first and last flag, > respectively --setting the value to "yes" (well, I knew that wasn't > going to work, but I had to check, right?) --upper case NO (ditto...) > --adding the following two lines to my xQuery file: > declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; > declare option output:omit-xml-declaration "no"; > > I know this question has come up before, but I couldn't find an approach that worked for me in the list archives. Obviously, at this point I'm just throwing darts at the problem. I'd be grateful for any pointers! > > Sincerely, > > > Regine Heberlein > Principal Cataloger and Metadata Analyst, Rare Book Collections > Princeton University Library One Washington Road Princeton, NJ 08540 > 609-258-6156 >
CG
Christian Grün7 Oct 2016 10:46 #
Quoted text · Regine I. Heberlein · 1 line
> Many thanks indeed, Christian!
…you are welcome! And I am glad to give you an update: The issue has already been fixed, and a new stable snapshot is available [1]. The next official release will be available soon.
[1] http://files.basex.org/releases/latest/
Quoted text · Regine I. Heberlein · 51 lines
> -----Original Message----- > From: Christian Grün [mailto:christian.gruen at gmail.com] > Sent: Thursday, October 06, 2016 10:36 AM > To: Regine I. Heberlein > Cc: basex-talk at mailman.uni-konstanz.de > Subject: Re: [basex-talk] problem getting -somit-xml-declaration=no to work > > Dear Regine, > > Welcome to the list. > >> I'm running an XQuery Update using BaseX from the command line over an XML document, and I want the XML declaration to be preserved. My input is: >> >> basex -uVwsomit-xml-declaration=no <input xQuery Update file> > > In BaseX, all XML documents are stored without XML declaration. > > However, I was surprised indeed that the declaration is not added in your example during serializtion, and I found out that it’s due to our current default serialization method ('basex'), which ignores this option (similar to the 'adaptive' method that has been added with XQuery 3.1 [1]). The following query works: > > basex -somit-xml-declaration=no -smethod=xml "<x/>" > > I would call this a bug, as it’s not the behavior most people would expect, and we’ll try to fix it soon [2]. > > Thanks for the report, > Christian > > [1] https://www.w3.org/TR/xslt-xquery-serialization-31/#adaptive-output > [2] https://github.com/BaseXdb/basex/issues/1369 > > > > >> That looks correct to me per the documentation, but when I run it, I lose the XML declaration nevertheless. (The xQuery Update executes correctly.) I've tried the following, all to no avail: >> >> --split out the -s flag, putting it as the first and last flag, >> respectively --setting the value to "yes" (well, I knew that wasn't >> going to work, but I had to check, right?) --upper case NO (ditto...) >> --adding the following two lines to my xQuery file: >> declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; >> declare option output:omit-xml-declaration "no"; >> >> I know this question has come up before, but I couldn't find an approach that worked for me in the list archives. Obviously, at this point I'm just throwing darts at the problem. I'd be grateful for any pointers! >> >> Sincerely, >> >> >> Regine Heberlein >> Principal Cataloger and Metadata Analyst, Rare Book Collections >> Princeton University Library One Washington Road Princeton, NJ 08540 >> 609-258-6156 >>
RH
Regine I. Heberlein7 Oct 2016 15:46 #
Oh wow, you guys work fast! :-) That's awesome, thanks so much!
Regine Heberlein
Principal Cataloger and Metadata Analyst, Rare Book Collections Princeton University Library
One Washington Road
Princeton, NJ 08540
609-258-6156
Quoted text · Christian Grün · 62 lines
-----Original Message----- From: Christian Grün [mailto:christian.gruen at gmail.com] Sent: Friday, October 07, 2016 4:47 AM To: Regine I. Heberlein Cc: basex-talk at mailman.uni-konstanz.de Subject: Re: [basex-talk] problem getting -somit-xml-declaration=no to work > Many thanks indeed, Christian! …you are welcome! And I am glad to give you an update: The issue has already been fixed, and a new stable snapshot is available [1]. The next official release will be available soon. [1] http://files.basex.org/releases/latest/ > -----Original Message----- > From: Christian Grün [mailto:christian.gruen at gmail.com] > Sent: Thursday, October 06, 2016 10:36 AM > To: Regine I. Heberlein > Cc: basex-talk at mailman.uni-konstanz.de > Subject: Re: [basex-talk] problem getting -somit-xml-declaration=no to > work > > Dear Regine, > > Welcome to the list. > >> I'm running an XQuery Update using BaseX from the command line over an XML document, and I want the XML declaration to be preserved. My input is: >> >> basex -uVwsomit-xml-declaration=no <input xQuery Update file> > > In BaseX, all XML documents are stored without XML declaration. > > However, I was surprised indeed that the declaration is not added in your example during serializtion, and I found out that it’s due to our current default serialization method ('basex'), which ignores this option (similar to the 'adaptive' method that has been added with XQuery 3.1 [1]). The following query works: > > basex -somit-xml-declaration=no -smethod=xml "<x/>" > > I would call this a bug, as it’s not the behavior most people would expect, and we’ll try to fix it soon [2]. > > Thanks for the report, > Christian > > [1] > https://www.w3.org/TR/xslt-xquery-serialization-31/#adaptive-output > [2] https://github.com/BaseXdb/basex/issues/1369 > > > > >> That looks correct to me per the documentation, but when I run it, I lose the XML declaration nevertheless. (The xQuery Update executes correctly.) I've tried the following, all to no avail: >> >> --split out the -s flag, putting it as the first and last flag, >> respectively --setting the value to "yes" (well, I knew that wasn't >> going to work, but I had to check, right?) --upper case NO (ditto...) >> --adding the following two lines to my xQuery file: >> declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; >> declare option output:omit-xml-declaration "no"; >> >> I know this question has come up before, but I couldn't find an approach that worked for me in the list archives. Obviously, at this point I'm just throwing darts at the problem. I'd be grateful for any pointers! >> >> Sincerely, >> >> >> Regine Heberlein >> Principal Cataloger and Metadata Analyst, Rare Book Collections >> Princeton University Library One Washington Road Princeton, NJ 08540 >> 609-258-6156 >>
Written for BaseX 8.5. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery