I'm trying to use the xQuery API for java s9api, however when I try to declare a namespace and run a simple rule to test it I restore the error "XPST0003: XQuery syntax error in
# ... if (funcJavaDict: CheckString #
Unexpected token "if (" beyond end of query "
Acretido is an easy error to solve, but I'm not getting to the solution,
The Java code snippet is:
//Declara namespace de funções java para usar nas regras
comp.declareNamespace ("funcJavaDict", "java:Rastreamento.retratos.DictionaryTerms");
comp.declareNamespace ("xmi", "http://www.omg.org/XMI");
//compila regra do arquivo
XQueryExecutable exp = null;
try {
exp = comp.compile("return /n"+
"if ( funcJavaDict:CheckString("em andamento","EM Andamento") ) then /n" +
" String("são iguais") /n"
"else /n"+
" String("são diferente") ");
}catch (SaxonApiException e) {
e.printStackTrace();
}
//carrega e executa regra
XQueryEvaluator Eval = exp.load();
XdmValue rs = null;
try {
rs = Eval.evaluate();
} catch (SaxonApiException e) {
e.printStackTrace();
}
the code is very simple is just to check if two string's are equivalent.