Details
-
Type:
Defect
-
Status:
Closed
-
Resolution: Declined
-
Affects Version/s: None
-
Fix Version/s: Release 1.3
-
Component/s: None
-
Labels:None
-
Approval:Not Approved
Description
I'm not expecting (emit (parse x)) to produce the same characters as originally in x. (That would be canonical form.)
However, it seems reasonable to expect that (= (parse x) (parse (emit (parse x)))). That's not currently the case because of #277 and #408.
It's not currently possible to demonstrate this bug via a unit test because of #409.
This fails:
(deftest parse-and-emit-should-round-trip-data
(are [s0]
(let [x1 (str->xml s0)
s2 (xml->str x1)
x3 (str->xml s2)]
(is (= x1 x3)))
"<e/>"
"<e></e>"
"<e>content</e>"
"<e a='attribute'/>"
"<e a='attribute'>content</e>"
"<e><e><e/></e></e>"
"<e> </e>"
"<e><&></e>"))
</code></pre>
Where:
<pre><code>(defn xml->str [x]
(with-out-str
(xml/emit-element x)))
(defn str->xml [s]
(xml/parse
(ByteArrayInputStream. (.getBytes s "UTF-8"))))
Or, rather it crashes prematurely in str->xml because of #409.
Converted from http://www.assembla.com/spaces/clojure/tickets/410
Attachments:
410-emit-element-no-longer-emits-spurious-new.patch - https://www.assembla.com/spaces/clojure/documents/b6SULoLZer346_eJe5cbLr/download/b6SULoLZer346_eJe5cbLr