B
Benjamin G. Jones
I am having a very basic problem with XQuery.
I want to use an XQuery API in Java (either Saxon or Qexo), and I have
an XQuery expression that works as expeced from the command line if I
specify a filename before the xpath expression.
What I want to know is this: If I want to use
Qexo's gnu.xquery.lang.XQuery.eval() or
Saxon's QueryExpression.evaluate(),
how do I specifiy the input in the Xquery statement?
For line 3 of the xquery, I want to say something analagous to:
let $vars=string({xml string goes here})//ci/text()
or
let $vars=input()//ci/text()
to read whatever the argument of eval is.
but neither of these seem to work.
Please please help!
Thanks,
(Expressions appear below).
------------ start xquery ---------------------------
1 <varlist>
2 {
3 let $vars:=document("equation.mml")//ci/text()
4 for $var in $vars
5 return
6 <var>{$var}</var>
7 }
8 </varlist>
------------ end xquery ---------------------------
on the xml file:
------------ start xml "equation.mml" ---------------------------
<math>
<apply>
<eq/>
<apply>
<plus/>
<apply>
<times/>
<cn>3</cn>
<apply>
<plus/>
<ci>x</ci>
<cn>2</cn>
</apply>
</apply>
<cn>3</cn>
</apply>
<ci>y</ci>
</apply>
</math>
------------ end xml equation.mml--------------------------
to produce (as expected)
-------------- begin output ------------------------------
<varlist>
<var>x</var><var>y</var>
</varlist>
-------------- end output --------------------------------
+----------------------------------------------------------------------+
+ Integre Technical Publishing, inc. +
+ http://www.integretechpub.com +
+ (505)889-8189 +
+----------------------------------------------------------------------+
I want to use an XQuery API in Java (either Saxon or Qexo), and I have
an XQuery expression that works as expeced from the command line if I
specify a filename before the xpath expression.
What I want to know is this: If I want to use
Qexo's gnu.xquery.lang.XQuery.eval() or
Saxon's QueryExpression.evaluate(),
how do I specifiy the input in the Xquery statement?
For line 3 of the xquery, I want to say something analagous to:
let $vars=string({xml string goes here})//ci/text()
or
let $vars=input()//ci/text()
to read whatever the argument of eval is.
but neither of these seem to work.
Please please help!
Thanks,
(Expressions appear below).
------------ start xquery ---------------------------
1 <varlist>
2 {
3 let $vars:=document("equation.mml")//ci/text()
4 for $var in $vars
5 return
6 <var>{$var}</var>
7 }
8 </varlist>
------------ end xquery ---------------------------
on the xml file:
------------ start xml "equation.mml" ---------------------------
<math>
<apply>
<eq/>
<apply>
<plus/>
<apply>
<times/>
<cn>3</cn>
<apply>
<plus/>
<ci>x</ci>
<cn>2</cn>
</apply>
</apply>
<cn>3</cn>
</apply>
<ci>y</ci>
</apply>
</math>
------------ end xml equation.mml--------------------------
to produce (as expected)
-------------- begin output ------------------------------
<varlist>
<var>x</var><var>y</var>
</varlist>
-------------- end output --------------------------------
+----------------------------------------------------------------------+
+ Integre Technical Publishing, inc. +
+ http://www.integretechpub.com +
+ (505)889-8189 +
+----------------------------------------------------------------------+