have a query report a warning?
Thursday, 3 March 2022 · 3 messages · last reply 4 Mar 2022
GS
Graydon Saunders3 Mar 2022 18:41 #
Hello all --
XPath has an error function,
https://www.w3.org/TR/xpath-functions-31/#func-error which stops processing, which isn't wanted when it's just a warning. ("this thing has problems; on to the next thing" shouldn't stop processing.)
XPath has a trace function,
https://www.w3.org/TR/xpath-functions-31/#func-trace which emits text, but which I think is like xsl:message and will write to STDOUT rather than STDERR.
This leaves me thinking I've missed something -- how should I have a query give a warning? I'm not finding something BaseX specific; I'm fairly sure neither error() nor trace() are correct.
Any suggestions?
Thanks!
Graydon
CG
Christian Grün4 Mar 2022 10:57 #
Hi Graydon,
In XQuery, there is no such thing as a warning function. If we included such a function in BaseX, we’d probably need to define rules for each API (GUI, clients, RESTXQ, others) how to return such warnings.
If you use BaseX on command-line, however, all output of
fn:trace, prof:dump, etc. will be sent to STDERR, so maybe that’s already what you are looking for.
Cheers,
ChristianQuoted text · Graydon Saunders · 15 lines
On Thu, Mar 3, 2022 at 5:42 PM Graydon Saunders <graydonish at gmail.com> wrote: > > Hello all -- > > XPath has an error function, https://www.w3.org/TR/xpath-functions-31/#func-error which stops processing, which isn't wanted when it's just a warning. ("this thing has problems; on to the next thing" shouldn't stop processing.) > > XPath has a trace function, https://www.w3.org/TR/xpath-functions-31/#func-trace which emits text, but which I think is like xsl:message and will write to STDOUT rather than STDERR. > > This leaves me thinking I've missed something -- how should I have a query give a warning? I'm not finding something BaseX specific; I'm fairly sure neither error() nor trace() are correct. > > Any suggestions? > > Thanks! > Graydon >
GS
Graydon Saunders4 Mar 2022 14:35 #
Hi Christian --
A definitive no means I can stop looking; thank you!
I think I will probably just put the warnings in the report being generated in what is maybe the more XML-appropriate way.
Much appreciated,
Graydon
Quoted text · Christian Grün · 43 lines
On Fri, Mar 4, 2022 at 4:57 AM Christian Grün <christian.gruen at gmail.com> wrote: > Hi Graydon, > > In XQuery, there is no such thing as a warning function. If we > included such a function in BaseX, we’d probably need to define rules > for each API (GUI, clients, RESTXQ, others) how to return such > warnings. > > If you use BaseX on command-line, however, all output of fn:trace, > prof:dump, etc. will be sent to STDERR, so maybe that’s already what > you are looking for. > > Cheers, > Christian > > > > On Thu, Mar 3, 2022 at 5:42 PM Graydon Saunders <graydonish at gmail.com> > wrote: > > > > Hello all -- > > > > XPath has an error function, > https://www.w3.org/TR/xpath-functions-31/#func-error which stops > processing, which isn't wanted when it's just a warning. ("this thing has > problems; on to the next thing" shouldn't stop processing.) > > > > XPath has a trace function, > https://www.w3.org/TR/xpath-functions-31/#func-trace which emits text, > but which I think is like xsl:message and will write to STDOUT rather than > STDERR. > > > > This leaves me thinking I've missed something -- how should I have a > query give a warning? I'm not finding something BaseX specific; I'm fairly > sure neither error() nor trace() are correct. > > > > Any suggestions? > > > > Thanks! > > Graydon > > >
Written for BaseX 9.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery