Disclaimer: I know very little about clojure (my experience has been with other functional languages and Java)
My gut instinct however says the problem is around prxml.invoke()
. The thought here being that that statement evaluates too soon, and sends the result to withOutStr (instead of letting withOutStr evaluate it).
Looking at the sources online alone... notably RT, Var & AFn as well as the clojure doc for with-out-str I would try something along the lines of:
String stringXML = (String) withOutStr.invoke(RT.list(prxml,"[:Name \"Bob\"]"));
Edit: Also I would suspect that it is able to call clojure macros from java otherwise the isMacro() function on Var seems rather silly...
Edit 2: Downloaded clojure, and tried it... doesn't work so ignore this for now.
Edit 3: with-out-str apparently requires 2 parameters so:
final Cons consXML = (Cons) withOutStr.invoke(prxml, RT.list("[:Name \"Bob\"]"));
final Object[] objs = RT.seqToArray(consXML);
System.out.println(Arrays.toString(objs));
has an output of: [clojure.core/let, [s__4095__auto__ (new java.io.StringWriter)], (clojure.core/binding [clojure.core/*out* s__4095__auto__] (clojure.core/str s__4095__auto__))]
I wonder if that will evaluate to something useful, or not (not sure if I'm correct on the bindings, have to figure out how to evaluate the cons through Java.
Edit 4: Poking through the Compiler and more code, it seems macros actually have 2 hidden parameters. See the commit 17a8c90
Copying the method in the compiler I have:
final ISeq form = RT.cons(withOutStr, RT.cons(prxml, RT.cons("[:Name \"Bob\"]", null)));
final Cons consXML = (Cons) withOutStr.applyTo(RT.cons(form, RT.cons(null, form.next())));
System.out.println(consXML.toString());
// Output: (clojure.core/let [s__4095__auto__ (new java.io.StringWriter)] (clojure.core/binding [clojure.core/*out* s__4095__auto__] #'clojure.contrib.prxml/prxml "[:Name \"Bob\"]" (clojure.core/str s__4095__auto__)))
Which seems a bit more promising, but it still requires the evaluation of the let expression which seems to have a special case in the compiler.