Created
August 26, 2014 03:36
-
-
Save scarcher2/aa761ba50424cb91e46b to your computer and use it in GitHub Desktop.
Clojure Transform Attempt
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
(ns sample.core) | |
(use '[clojure.data.xml :as data.xml]) | |
(use '[clojure.java.io :as io]) | |
(defn process-contact | |
"I don't do a whole lot." | |
[contact] | |
(println contact) | |
(println (:content (:first (:content contact)))) | |
[:id (:id (:attrs contact)) :first-name (:first (:content contact)) :last-name (:last (:content contact)) :email-address (:email (:content contact))] | |
) | |
(defn contact-seq | |
"Test" | |
[rdr] | |
(->> (:content (data.xml/parse rdr)) | |
(filter #(= :contact (:tag %))) | |
(map process-contact))) | |
(defn run-sample | |
"FUN" | |
[] | |
(contact-seq (io/input-stream "contacts.xml"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment