 (defn ^String xml-escape [^String s]
   (-> s
       (.replaceAll "&"  "&amp;")
-      (.replaceAll "<"  "&lt;")
-      ))
+      (.replaceAll "<"  "&lt;")))
 
 (defn ^String xml-escape-attr [^String s]
   (-> s
       xml-escape
-      (.replaceAll "'"  "&apos;")
-      ))
+      (.replaceAll "'"  "&apos;")))
+
+(defn ^String xml-escape-comment [^String s]
+  ;; Comment text can't contain -->
+  (-> s
+      xml-escape
+      (.replaceAll "-->" "--&gt;")))
+
 
 (defn emit-element [^Element e ^Writer out]
   (let [{:keys [tag attrs content]} e]

    (emit-xml (str o) out))
  
  )

(defn emit
  "Turn an element into a String of XML."

;;; Alias for the Element class
(def element-type Element)

(defn- elementize
  "This is used to turn a tree of element-like maps into a tree of
  Element instances."
  ;; TODO - is this still used anywhere?
  [e]
  (if (and (not (element? e))
           (map? e)
           (:tag e))
    (Element.
     (:tag e)
     (:attrs e)
