public static String selectTaskId() {
      XhiveDriverIf driver = XhiveDriverFactory.getDriver("xhive://localhost:1235");
      if (driver.isInitialized() == false) driver.init();

      XhiveSessionIf session = driver.createSession("xqapi-test");
      session.connect("Administrator", "imen", "vbpmn");
      session.begin();
      String s2 = "";
      try {
        XhiveLibraryIf rootLibrary = session.getDatabase().getRoot();
        // (1)
        int j = 0;
        IterableIterator<? extends XhiveXQueryValueIf> result =
            rootLibrary.executeXQuery(
                "for  $a in fn:doc('Last_activity.xml')/Activities return $a/id");

        while (result.hasNext()) {
          s2 = result.next().toString();
          j = s2.indexOf("<id>");
          s2 = s2.substring(j + 4);
          j = s2.indexOf("</id>");
          s2 = s2.substring(0, j);
        }

        session.commit();
      } finally {
        session.rollback();
      }
      return s2;
    }
    public static String Selectstate(String id_v) {
      XhiveDriverIf driver = XhiveDriverFactory.getDriver("xhive://localhost:1235");
      int i = 0;
      if (driver.isInitialized() == false) driver.init();

      XhiveSessionIf session = driver.createSession("xqapi-test");
      session.connect("Administrator", "imen", "vbpmn");
      session.begin();
      String s2 = "";
      try {
        XhiveLibraryIf rootLibrary = session.getDatabase().getRoot();
        // (1)
        int j = 0;
        IterableIterator<? extends XhiveXQueryValueIf> result =
            rootLibrary.executeXQuery(
                "for $o in doc('Processes.xml')/Processes/Process for $i in $o/versions/version where $i/id_v='"
                    + id_v
                    + "' return $i/state");
        //  IterableIterator<? extends XhiveXQueryValueIf>  result = rootLibrary.executeXQuery("for
        // $p in fn:doc('Processes.xml')/Processes/Process  let $i:=<version></version> where
        // $p/name='"+name+"' return insert nodes  $i into $p/versions");
        while (result.hasNext()) {
          s2 = result.next().toString();
          System.out.println(j + "s2" + s2);
          j++;
        }
        s2 = s2.substring(7);
        j = s2.indexOf("<");
        s2 = s2.substring(0, j);

        session.commit();
      } finally {
        session.rollback();
      }

      return s2;
    }