[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qexo-general] Newbe question
From: |
Ayal Spitz |
Subject: |
[Qexo-general] Newbe question |
Date: |
19 Dec 2002 11:36:12 -0500 |
I'm having some trouble writing code to use Qexo. I'm writing this list
in hopes that someone might see the flaw in my code and help me out. I'm
working with NetBeans 3.4.1beta on top of J2SE 1.4 on RedHat Linux 8. I
downloaded the latest copy Kawa from CVS, following the directions at
http://www.gnu.org/software/kawa/Getting-Kawa.html. I compiled the CVS
code using './configure' and 'make'. I added the result
'kawa-1.6.99.jar' to my NetBeans project and the code bellow:
import gnu.xquery.lang.XQuery;
import gnu.xml.XMLPrinter;
import java.io.OutputStreamWriter;
import java.io.Writer;
/**
*
* @author aspitz
*/
public class Qexo{
public static void main(String[] args){ new Qexo(); }
public Qexo(){
XQuery xQuery = null;
Writer systemOutWriter = null;
XMLPrinter xmlPrinter = null;
String exp = null;
xQuery = new XQuery();
systemOutWriter = new OutputStreamWriter(System.out);
xmlPrinter = new XMLPrinter(systemOutWriter);
//exp = "for $x in (3,4,5) return <a>{$x}</a>";
exp = "string-value(<a>3+5 is {3+5}</a>)";
System.out.print(exp);
System.out.print(" => ");
try{
xQuery.eval(exp,xmlPrinter);
}catch(Throwable t){ t.printStackTrace(); }
xmlPrinter.println();
xmlPrinter.flush();
}
}
When I run the code inside, and outside of Netbeans, I get the
following:
string-value(<a>3+5 is {3+5}</a>) =>
gnu.mapping.UnboundSymbol: Unbound symbol string-value
at
gnu.expr.Interpreter.getDefaultSymbolValue(Interpreter.java:609)
at gnu.expr.Interpreter.getSymbolValue(Interpreter.java:616)
at gnu.expr.ReferenceExp.eval(ReferenceExp.java:104)
at gnu.expr.ApplyExp.eval(ApplyExp.java:52)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:160)
at gnu.expr.Interpreter.eval(Interpreter.java:587)
at gnu.expr.Interpreter.eval(Interpreter.java:568)
at gnu.expr.Interpreter.eval(Interpreter.java:550)
at gnu.expr.Interpreter.eval(Interpreter.java:544)
at spitz.ayal.qexo.Qexo.<init>(Qexo.java:38)
at spitz.ayal.qexo.Qexo.main(Qexo.java:20)
When I attempt to evaluate the same expression using 'java -jar
Kawa-1.6.99.jar --xquery' I get:
{--1--} string-value(<a>3+5 is {3+5}</a>)
3+5 is 8
Which is closer to the right answer, but I was expecting '<a>3+5 is
8</a>'.
If anyone has any ideas I would appreciate the help. Thanks in advance -
AYAL
--
Ayal Spitz <address@hidden>
- [Qexo-general] Newbe question,
Ayal Spitz <=