Skip to content

Commit 2a202da

Browse files
committed
DXML-35 print newline after preamble
1 parent b0f1e96 commit 2a202da

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
From 0.2.0-alpha2 to 0.2.0-alpha3
22
- Minimum requirement is now clojure 1.7.0
3+
- Print newline after preamble when pretty-printing (DXML-35)
34

45
From 0.2.0-alpha1 to 0.2.0-alpha2
56
- qname function now returns canonical (keyword) names

src/main/clojure/clojure/data/xml/jvm/pprint.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
(doto (-> (TransformerFactory/newInstance) .newTransformer)
1717
(.setOutputProperty (OutputKeys/INDENT) "yes")
1818
(.setOutputProperty (OutputKeys/METHOD) "xml")
19-
(.setOutputProperty "{http://xml.apache.org/xslt}indent-amount" "2")))
19+
(.setOutputProperty "{http://xml.apache.org/xslt}indent-amount" "2")
20+
;; print newline after preamble https://bugs.openjdk.java.net/browse/JDK-7150637
21+
(.setOutputProperty "http://www.oracle.com/xml/is-standalone" "yes")))
2022

2123
(defn indent-xml
2224
[xml-str ^Writer writer]

src/test/clojure/clojure/data/xml/test_pprint.clj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,10 @@
1616
(def xml
1717
"<foo><bar/></foo>")
1818

19-
(defn jdk8? []
20-
(-> (System/getProperty "java.version")
21-
(.startsWith "1.8")))
22-
2319
(def indented-xml
2420
(str
2521
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
26-
(when-not (jdk8?) "\n")
22+
"\n"
2723
"<foo>
2824
<bar/>
2925
</foo>

0 commit comments

Comments
 (0)