-
-
Save nicholasf/e8309e6b2ffea364654f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn to-zip | |
"Converts a clojure.data.xml load into a clojure.zip zipper" | |
[xml-data] | |
(-> xml-data czip/xml-zip)) | |
(defn load-feed | |
"Loads the given filename" | |
[filename] | |
(-> filename | |
clojure.java.io/resource | |
clojure.java.io/input-stream | |
clojure.data.xml/parse)) | |
(defn stream-as-agencies | |
"An example mapping function using xml-> and xml1-> zipping" | |
[listings-zip] | |
(let [agencies (take 5 (xml-> listings-zip :Agencies :Agency))] | |
(doseq [agency agencies]) | |
(println "*"))) | |
(defn two-gig-file | |
"The transformed sample data" | |
[] | |
(stream-as-agencies (to-zip (load-feed "Live.xml")))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment