从理论的角度来看,如何在Java中运行BaseX数据库的命令(如http://docs.basex.org/wiki/Commands中描述的命令)。存在一些工作到高于XPath的抽象级别的框架?
BaseX提供了一大堆native language clients that directly connect with BaseX' API。
使用QUERY
命令归结为连接然后查询数据库,摘自官方查询documentation example:
// create session
BaseXClient session = new BaseXClient("localhost", 1984, "admin", "admin");
final String input = "for $i in 1 to 10 return <xml>Text { $i }</xml>";
Query query = session.query(input);
while(query.more()) {
System.out.println(query.next());
}
其他命令具有相同类型的接口。
BaseX也可以在Java中使用im嵌入模式,请参阅BaseX文档的"Local Examples"部分。