Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed top level parse function name from lazy-parse to parse

  • Loading branch information...
commit c69b06dcac8b22a3f9e412aa51f8e1d66e3a8073 1 parent 262550f
@senior senior authored
View
18 src/main/clojure/clojure/data/xml.clj
@@ -117,16 +117,6 @@
(fn [^Event event] (.str event))
events)))
-#_(defn parse
- "Convenience function. Parses the source, which can be a File,
- InputStream or String naming a URI, and returns a tree of
- Element records. See source-seq for finer-grained control."
- [source]
- (event-tree (source-seq
- (if (instance? Reader source)
- (InputSource. source)
- source))))
-
(defprotocol AsElements
(as-elements [expr] "Return a seq of elements represented by an expression."))
@@ -228,7 +218,7 @@
XMLStreamConstants/END_DOCUMENT
nil))))
-(defn lazy-source-seq
+(defn source-seq
"Parses the XML InputSource source using a pull-parser. Returns
a lazy sequence of Event records. See clojure.data.xml/lazy-source-seq
for similar results but without requiring an external pull parser."
@@ -236,16 +226,14 @@
(let [fac (doto (javax.xml.stream.XMLInputFactory/newInstance)
(.setProperty javax.xml.stream.XMLInputFactory/IS_COALESCING true))
sreader (.createXMLStreamReader fac s)]
- ;(.setNamespaceAttributesReporting xpp true)
- ;(.setInput xpp s)
(pull-seq sreader)))
-(defn lazy-parse
+(defn parse
"Convenience function. Parses the source, which can be a File,
InputStream or String naming a URI, and returns a lazy tree of
Element records. See lazy-source-seq for finer-grained control."
[source]
- (event-tree (lazy-source-seq source)))
+ (event-tree (source-seq source)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; XML Emitting
View
3  src/test/clojure/clojure/data/xml/test_emit.clj
@@ -35,9 +35,6 @@
"</a>")]
(is (= expect (with-out-str (xml/emit deep-tree))))))
-"<?xml version=\"1.0\" encoding=\"UTF-8\"?><mixed double=\"&quot;double&quot;quotes&quot;here&quot;\" single=\"'single'quotes'here\"/>"
-"<?xml version=\"1.0\" encoding=\"UTF-8\"?><mixed double=\"&quot;double&quot;quotes&quot;here&quot;\" single=\"'single'quotes'here\"></mixed>"
-
(deftest mixed-quotes
(is (= (str "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<mixed double=\"&quot;double&quot;quotes&quot;here&quot;\""
View
2  src/test/clojure/clojure/data/xml/test_utils.clj
@@ -14,6 +14,6 @@
(defn test-stream [x]
(java.io.ByteArrayInputStream. (.getBytes x)))
-(def lazy-parse* (comp xml/lazy-parse test-stream))
+(def lazy-parse* (comp xml/parse test-stream))
Please sign in to comment.
Something went wrong with that request. Please try again.