code: public static XNElement createRequest(String function, Object... nameValue) {
          XNElement result = new XNElement(function);
          for (int i = 0; i < nameValue.length; i += 2) {
              result.set((String)nameValue[i], nameValue[i + 1]);
          }
          return result;
      }
docs: Create a request with the given function and name-value pairs.
  @param function the remote function name
  @param nameValue the array of String name and Object attributes.
  @return the request XML