Exemple #1
0
  /**
   * Create a new context for the specified object that has access to the supplied functions.
   *
   * @param object the context bean
   * @param functions the functions
   * @return JXPathContext the context object
   */
  public static JXPathContext newContext(Object object, Functions functions) {
    JXPathContext context = JXPathContext.newContext(object);
    FunctionLibrary lib = new FunctionLibrary();
    lib.addFunctions(context.getFunctions());
    lib.addFunctions(functions);
    context.setFunctions(lib);
    context.setLenient(true);

    return context;
  }