Package org.zorbaxquery.api

Examples of org.zorbaxquery.api.XQuery


   * @param args
   */
  public static void main(String[] args) {
    Store store = InMemoryStore.getInstance();
    Zorba zorba = Zorba.getInstance(store);
    XQuery xquery = zorba.compileQuery("declare variable $input external; for $x in $input//b return $x");
    xquery.setVariableAsDocument("input", "test.xml", "<a><b>Hallo</b><b>Lukas</b><b>1</b></a>");
    Iterator iter = xquery.iterator();
    iter.open();
    Item item = new Item();
    while(iter.next(item)){
      String test = item.getStringValue();
      System.out.println(test);
    }
    iter.close();
    iter.destroy();
    xquery.destroy();
    zorba.shutdown();
  }
View Full Code Here


  private void callZorbaCalls(String filename, String value) throws Exception {
    InMemoryStore store = InMemoryStore.getInstance();
    Zorba zorba = Zorba.getInstance(store);
    String query = "declare variable $test external;" + "$test//b";
    XQuery xquery = zorba.compileQuery(query);
    xquery.setVariableAsDocument("test", filename, value);
    Iterator iter = xquery.iterator();
    iter.open();
    Item item = new Item();
    while (iter.next(item)) {
      String itemStr = item.serialize();
      System.out.println(itemStr);
    }
    // clean up
    iter.close();
    iter.destroy();
    xquery.destroy();
    zorba.shutdown();
    InMemoryStore.shutdown(store);
  }
View Full Code Here

TOP

Related Classes of org.zorbaxquery.api.XQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.