I'm having issues inserting a new node into exist-db using Java.
If I run this Xquery from eXide it will run fine and will insert the new department:
update insert < DEP_ROW >< DEPT_NO >1< /DEPT_NO >< DNOMBRE >A< /DNOMBRE >< LOC >A< /LOC >< /DEP_ROW > into /departamentos
However, if I try to do it from Java it says that there's a syntax error. The code is:
String queryString = "update insert <DEP_ROW><DEPT_NO>1</DEPT_NO><DNOMBRE>A</DNOMBRE><LOC>A</LOC></DEP_ROW> into /departamentos";
consulta = conn.prepareExpression(queryString);
consulta.executeQuery();
And the error is:
Exception in thread "main" javax.xml.xquery.XQException:
XQJQS001 - Invalid XQuery syntax, syntax does not pass static
validation.
Root Cause:
XQueryParseException: Encountered "insert" at line 1, column 8.
Was expecting one of:
<EOF>
"%%%" ...
"=" ...
"," ...
"or" ...
"and" ...
"to" ...
"*" ...
"div" ...
"idiv" ...
"mod" ...
"union" ...
"|" ...
"intersect" ...
"except" ...
"instance" ...
"treat" ...
"castable" ...
"cast" ...
"!=" ...
"<=" ...
">" ...
">=" ...
"eq" ...
"ne" ...
"lt" ...
"le" ...
"gt" ...
"ge" ...
"is" ...
"<<" ...
">>" ...
"[" ...
"-" ...
"+" ...
"<" ...
"/" ...
"//" ...
"(" ...
at Visualizar.insertadep(Visualizar.java:58)
at Visualizar.main(Visualizar.java:23)
at Visualizar.insertadep(Visualizar.java:58)
at Visualizar.main(Visualizar.java:23)
I really appreciate your help.
Thanks,