Hi,

I believe the following is a bug in clojure.contrib.lazy-xm:

user=> (use 'clojure.contrib.lazy-xml)
nil
user=> (emit { :tag :a, :attrs { :b "bloody apostrophe's :-)" }})
<?xml version='1.0' encoding='UTF-8'?>
<a b='bloody apostrophe's :-)'/>
nil

The XML is broken, because the embedded apostrophe in attribute b is
not replaced with an XML entity.

The apostrophe must be added to the characters to be escaped. Changing
line 125 in lazy-xml.clj to the following fixed it for me:

(def escape-xml-map {\< "&lt;" \> "&gt;" \" "&quot;" \& "&amp;" \'
"&apos;"})

Expected result:

user=> (use 'clojure.contrib.lazy-xml)
nil
user=> (emit { :tag :a, :attrs { :b "bloody apostrophe's :-)" }})
<?xml version='1.0' encoding='UTF-8'?>
<a b='bloody apostrophe&apos;s :-)'/>
nil

Regards
Stephan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to