diff --git a/src/main/clojure/clojure/data/xml.clj b/src/main/clojure/clojure/data/xml.clj index 02d0772..eba575d 100644 --- a/src/main/clojure/clojure/data/xml.clj +++ b/src/main/clojure/clojure/data/xml.clj @@ -214,12 +214,10 @@ (cons (event :characters nil nil text) (pull-seq sreader)) (recur)) - XMLStreamConstants/COMMENT - (recur) - XMLStreamConstants/SPACE - (recur) XMLStreamConstants/END_DOCUMENT - nil)))) + nil + (recur);; Consume and ignore comments, spaces, processing instructions etc + )))) (defn source-seq "Parses the XML InputSource source using a pull-parser. Returns diff --git a/src/test/clojure/clojure/data/xml/test_parse.clj b/src/test/clojure/clojure/data/xml/test_parse.clj index dfb1271..74d41f2 100644 --- a/src/test/clojure/clojure/data/xml/test_parse.clj +++ b/src/test/clojure/clojure/data/xml/test_parse.clj @@ -59,3 +59,17 @@ "there")))] (is (= expected (lazy-parse* input))))) +(deftest test-parsing-processing-instructions + (let [input " + + With Stuff" + expected (element :ATag {} "With Stuff")] + (is (= expected (parse-str input))))) + +(deftest test-parsing-doctypes + (let [input " +

Heading Stuff

" + expected (element :html {} + (element :h1 {} "Heading Stuff"))] + (is (= expected (parse-str input))))) \ No newline at end of file