Thank you very, very much, Christian. Hans-Jürgen
Christian Grün christian.gruen@gmail.com schrieb am 14:10 Donnerstag, 19.März 2015:
I used -I for the flag [1]. It's available in the latest 8.1 snapshot [2].
Have fun, Christian
[1] http://docs.basex.org/wiki/Command-Line_Options [2] http://files.basex.org/releases/latest/
On Tue, Mar 17, 2015 at 12:52 PM, Hans-Juergen Rennau hrennau@yahoo.de wrote:
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