|
From: | John Ohno |
Subject: | Re: [Qexo-general] Using qexo from Java with unusual input & output formats |
Date: | Thu, 10 Sep 2015 19:12:59 +0000 |
On 09/10/2015 08:35 PM, John Ohno wrote:
> Hi,
> I'd like to use qexo in conjunction with FastInfoset -- in other words, to use a DOM I've parsed myself as the context object (because qexo will not happily parse FI documents itself), and then take the result and serialize it myself. While the second part is relatively straightforward, I can't figure out how to convince qexo of the default XML context.
>
> I found the following item from ten years ago:
Setting an external input variable (as described in the 27 Sep 2005 message)
seems to work - I just tried it:
$ kawa input=kawa-sources/gnu/xquery/testsuite/bib.xml --xquery -e 'declare variable $input external; doc($input)/bib/book/title'
<title>TCP/IP Illustrated</title><title>Advanced Programming in the Unix environment</title><title>Data on the Web</title><title>The Economics of Technology and Content for Digital TV</title>
(I tried bib.xml in the Kawa source tree.)
>
>> From: Per Bothner
>> Subject: Re: [Qexo-general] How to specify input files at runtime?
>> Date: Tue, 27 Sep 2005 08:28:26 -0700
>> User-agent: Mozilla Thunderbird 1.0.6-1.1.fc4 (X11/20050720)
>> [Sorry I didn't see this in the input queue among all the spam, until now.] daniel mahler wrote:
>>
>>> How can I specify input files at run time, ie. do somehing like $ java kawa.repl --xquery script.xql file.xml or $ java kawa.repl --xquery script.xql < file.xml All XQuery examples I've seen hardcode the input file in the script. Surely this is not what people >> actually do. Generating the xquery dynamically just for this looks like massive
>>> overkill.
>> You can use an external variable to specify a filename/URL. Thus in script.xql: declare variable $input external; doc($input) > Then invoke it thus: java kawa.repl --xquery input=file.xml script.xql You need a fairly recent version of Qexo (I suggest the just-announced release candidate of 1.8) to be able to use extenal variables. -- --Per Bothner address@hidden > http://per.bothner.com/
>
> Is this still the case? Or, has this feature been introduced?
Seems to still work.
--
--Per Bothner
address@hidden http://per.bothner.com/
[Prev in Thread] | Current Thread | [Next in Thread] |