aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChouser <chouser@n01se.net>2010-02-11 16:34:06 -0500
committerChouser <chouser@n01se.net>2010-02-11 16:34:38 -0500
commit5d30e632710faf1b74ef7826ba5bf1bde737e5ef (patch)
tree2a9ca59eb6d8883fb3f405bd1e07d5d69f177c2a
parentb1ef9357a276c391ac28c309513c567b84a09309 (diff)
Stop using c.c.java in pprint examples.
-rw-r--r--src/examples/clojure/clojure/contrib/pprint/examples/json.clj4
-rw-r--r--src/examples/clojure/clojure/contrib/pprint/examples/xml.clj10
2 files changed, 9 insertions, 5 deletions
diff --git a/src/examples/clojure/clojure/contrib/pprint/examples/json.clj b/src/examples/clojure/clojure/contrib/pprint/examples/json.clj
index 97d76844..afe1a2c2 100644
--- a/src/examples/clojure/clojure/contrib/pprint/examples/json.clj
+++ b/src/examples/clojure/clojure/contrib/pprint/examples/json.clj
@@ -19,8 +19,8 @@
This is an example of using a pretty printer dispatch function to generate JSON output",
:see-also [["http://json.org/", "JSON Home Page"]]}
clojure.contrib.pprint.examples.json
- (:require [clojure.contrib.java :as j])
(:use [clojure.test :only (deftest- is)]
+ [clojure.contrib.string :only (as-str)]
[clojure.contrib.pprint :only (write formatter-out)]))
@@ -62,7 +62,7 @@ This is an example of using a pretty printer dispatch function to generate JSON
(defmethod dispatch-json ::object [m]
((formatter-out "~<{~;~@{~<~w:~_~w~:>~^, ~_~}~;}~:>")
- (for [[k v] m] [(j/as-str k) v])))
+ (for [[k v] m] [(as-str k) v])))
(defmethod dispatch-json java.lang.CharSequence [s]
(print \")
diff --git a/src/examples/clojure/clojure/contrib/pprint/examples/xml.clj b/src/examples/clojure/clojure/contrib/pprint/examples/xml.clj
index 2753eb9d..18c3cfec 100644
--- a/src/examples/clojure/clojure/contrib/pprint/examples/xml.clj
+++ b/src/examples/clojure/clojure/contrib/pprint/examples/xml.clj
@@ -19,8 +19,7 @@
#^{:author "Tom Faulhaber, based on the original by Stuart Sierra",
:doc "A version of prxml that uses a pretty print dispatch function."}
clojure.contrib.pprint.examples.xml
- (:use [clojure.contrib.lazy-xml :only (escape-xml)]
- [clojure.contrib.java :only (as-str)]
+ (:use [clojure.contrib.string :only (as-str escape)]
[clojure.contrib.pprint :only (formatter-out write)]
[clojure.contrib.pprint.utilities :only (prlabel)]))
@@ -80,8 +79,13 @@
(defmethod xml-dispatch clojure.lang.Keyword [x]
(print-xml-tag x {} nil))
+
(defmethod xml-dispatch String [x]
- (print (escape-xml x)))
+ (print (escape {\< "&lt;"
+ \> "&gt;"
+ \& "&amp;"
+ \' "&apos;"
+ \" "&quot;"} x)))
(defmethod xml-dispatch nil [x])