Hi
I change the query to
String query = "for $item in doc('src/xmlFile/input.xml')//package return insert node <e123/> into $item";
with doc and is still not working.
Thanks
Eitan Elmalam
2014-03-13 15:00 GMT+02:00 BaseX Support support@basex.org:
Maybe it's due to...
https://github.com/BaseXdb/basex/issues/848 http://docs.basex.org/wiki/Options#WRITEBACK
Please use the basex-talk mailing list for future requests. ____________________________________
On Thu, Mar 13, 2014 at 1:50 PM, eitan elmalam eitan.elmalam@gmail.com wrote:
Hello BaseX Support
I am trying to do simple thing. I want to confige the data base to WRITEBACK true , that changes on XML
file
will execute on the file on the disc. And after that to execute query insert and to see the file on the disck changed. I send you the test case code, please check why is not work.
Thanks Eitan Elmalam.
/**
@param args
@throws BaseXException
*/
public static void main(String[] args) throws BaseXException {
try {
String LOCAL_DB_NAME1 = "LocalDB";
String LOCAL_DB_PATH1 = "src/xmlFile/input.xml";
Context context1 = new Context();
// Start server on default port 1984
BaseXServer server = new BaseXServer();
ClientSession session = new ClientSession("localhost", 1984,
"admin", "admin");
session.execute(new CreateDB(LOCAL_DB_NAME1, LOCAL_DB_PATH1));
String query = "for $item in //package return insert node <e123/> into $item";
//String query = "//package";
session.query(query).execute();
BaseXXQDataSource xqjd = null;
XQConnection conn;
XQExpression xqe;
xqjd = new BaseXXQDataSource();
conn = xqjd.getConnection("admin", "admin");
xqe = conn.createExpression();
xqe.executeCommand("SET WRITEBACK true");
} catch (Exception e) {
e.printStackTrace();
}
}
<App name="BasexTest_1">
<package name="main/resources/xml">
<file name="input.xml"/>
<e/>
<e/>
<e1/>
<e12/>
</package>
<package name="org/basex/examples/local">
<file name="RunCommands.java"/>
<folder>lib</folder>
<e/>
<e/>
<e1/>
<e12/>
</package>
</App>
2014-03-11 23:17 GMT+02:00 BaseX Support support@basex.org:
Eitan,
if you want help, please spend more time in creating examples that work out of the box (see [1] for more details), and write to the basex-talk mailing list. What do you expect your qeery to do? What is the error?
Christian
[1] http://www.sscce.org/ ____________________________________
I am create DB instance , and create client server for create
expression
to execute the command (("SET WRITEBACK true"); But the command not working , please help . See the code below.
Thanks Eitan Elmalam
public void createDB(String dbName, String dbPath) throws IOException
{
CreateDB db = new CreateDB(dbName, dbPath); db.execute(context); BaseXServer server = new BaseXServer(context);
session = new ClientSession("localhost", 1984, "alex", "admin");
XQDataSource ds = null; BaseXXQDataSource xqjd = null;
try { xqjd = new BaseXXQDataSource();
conn = xqjd.getConnection("alex", "admin");
} catch (Exception e) {
}
try { this.xqe = this.conn.createExpression(); } catch (XQException e) { e.printStackTrace(); }
int j = 0; try { xqe.executeCommand("SET WRITEBACK true"); } catch (XQException e) { e.printStackTrace(); }
}