It was a problem in Java syntax. I should have used session.execute(new XQuery(query)). Now it works fine.

Thanks
Sree aurovindh V


On Wed, Jul 17, 2013 at 6:57 PM, Sree Aurovindh Viswanathan <sreeaurovindh@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