Binding external java map to basex xquery map

Viewed 27

I have requirement to bind the java hashmap to basex xquery map. And then using map key,value to insert the node tag as $key $value "

But am facing issue in the first stage itself,to bind the java hash map to basex xquery map.

Example tried:

     Hashmap<String,String> values = 
     new Hashmap();
     values.put("cust1","custval1");
     values.put("cust2","custval2");
     Final String input = "decalre 
     variable $map as map(*) 
     external;"
     Context ctx = new Context();
    QueryProcessor p = new 
    QueryProcessor(input,ctx);
     p.bind("map",values);
    P.execute();
    p.close();
    ctx.close();

Getting below exception, org.basex.query.QueryException : Invalid cast from java() to map(*): "{cust1=custval1,cust2=custval2}"

Am using 7.3.1 version of basex QueryProcessor in java.

Please let me know what's wrong with above code snippet. How can bind the java map to xquery map and using to insert xml node.

0 Answers
Related