Hi,

   How to pass a node object as parameter to xquery from java.

   Scenario is
   *we have an xquery file as "insert.xqy"  which looks like*

   *define variable $uri as xs:string external
   define variable $content as node() external
   xdmp:document-insert($uri,$content)*


   *From java we are passing parameters to the xquery using xcc Api like*

  String *content* = "<employee> <name>dhana</name></employee>";
  ContentSource contentSource =
ContentSourceFactory.newContentSource("localhost",xx,"xxxxx","xxx");
         Session session = contentSource.newSession();
         ModuleInvoke invoke = session.newModuleInvoke(null);
         RequestOptions requestOptions = new RequestOptions();
         invoke.setOptions(requestOptions);

         invoke.setModuleUri("/insert.xqy");
         invoke.setNewStringVariable("uri","*/cam/db/sample.xml*");
         invoke.setNewStringVariable("content",*content*);

         *//invoke.setNewVariable("content", ValueType.NODE,content);    we
are  trying to set the value like this it throw following exception

         com.marklogic.xcc.exceptions.UnimplementedFeatureException: Setting
variables of type XdmNode is not supported

*        try {
            session.submitRequest(invoke);
        } catch (RequestException e) {
            e.printStackTrace();
        }

*     document-insert() method take 2nd argument as node  but In our case we
have the xml as string ,so How to pass  xml as node to xquery?*

Thanks in Advance

  Regards
  Parthiban.K
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to