Unknown Command let
Thursday, 18 July 2013 · 2 messages
SV
Sree Aurovindh Viswanathan18 Jul 2013 05:57 #
Hi,
I am trying to use BaseX and Java. The Following is my XQuery that I am trying to run.
I am using Java to run it.
String query = "let $up := <food id=\"3\">\n" +
" <name>Belgian Waffles</name>\n" +
" <price>5.95</price>\n" +
" <calories>650</calories>\n" +
" </food>";
query+= "for $doc in collection('factDB/xmlDocs') for $myVar in
$doc/breakfast[@menuId='3']/food[@id='6'] return insert node $up as last
into $myVar";
session.execute(query);
}The error I get is the following:
org.basex.core.BaseXException: Stopped at line 1, column 7:
Unknown command: declare. Try HELP.
Can you please help me to resolve this issue.
Thanks
Sree Aurovindh Viswanathan
SV
Sree Aurovindh Viswanathan18 Jul 2013 07:26 #
It was a problem in Java syntax. I should have used session.execute(new XQuery(query)). Now it works fine.
Thanks
Sree aurovindh V
Quoted text · Sree Aurovindh Viswanathan · 33 lines
On Wed, Jul 17, 2013 at 6:57 PM, Sree Aurovindh Viswanathan < sreeaurovindh at gmail.com> wrote: > Hi, > > I am trying to use BaseX and Java. The Following is my XQuery that I am > trying to run. > > I am using Java to run it. > > > String query = "let $up := <food id=\"3\">\n" + > " <name>Belgian Waffles</name>\n" + > " <price>5.95</price>\n" + > " <calories>650</calories>\n" + > " </food>"; > > query+= "for $doc in collection('factDB/xmlDocs') for $myVar in > $doc/breakfast[@menuId='3']/food[@id='6'] return insert node $up as last > into $myVar"; > session.execute(query); > } > > The error I get is the following: > > org.basex.core.BaseXException: Stopped at line 1, column 7: > Unknown command: declare. Try HELP. > > > Can you please help me to resolve this issue. > > Thanks > Sree Aurovindh Viswanathan >
Written for BaseX 7.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery