Dear BaseX team,
if I understand the documentation correctly, the processing of standard input is currently restricted to "-i-", that is, reading standard input as an XML document providing the context item, e.g. so:
myCmd | basex -i- -q //foo
Nice, but how about standard input which corresponds, for example, to a JSON document or a CSV document? Wouldn't it be useful to be able to apply functions to standard input,. e.g. json:parse, csv:parse or simple fn:unparsed-text? Example use case: NAGIOS commands piping the output of a command into BaseX.
Whereas the context item can have any item type, the command line option -i accepts only documents, and that is the problem. I experimented with the "declare context item" declaration, but it did not work. And, at any rate, I would appreciate the conciseness of using an atomic context item without having to add the "declare context item" declaration.
One solution were a new command line option (e.g. -j) which represents the context item as xs:untypedAtomic, and which also understands "-" to denote standard input. Then one could do this:
myCmd | basex -j- json:parse(.)//foo
That would be very nice and broaden the scope of BaseX again by a meter or two.
Cheers,Hans-Jürgen