Skip to content

Instantly share code, notes, and snippets.

@martintrojer
Last active December 16, 2015 18:49
Show Gist options
  • Save martintrojer/5480505 to your computer and use it in GitHub Desktop.
Save martintrojer/5480505 to your computer and use it in GitHub Desktop.
cljutlet
;;http://snellm.github.io/cutlet/
(ns cljutlet.core
(:use [clojure.data.zip.xml])
(:require [clojure.xml :as xml]
[clojure.zip :as zip]))
(def data (zip/xml-zip (xml/parse "people.xml")))
(for [p (xml-> data :person)]
{:forename (xml1-> p :firstname text)
:surname (xml1-> p :lastname text)
:mobile (str "mobile-" (xml1-> p :phonenumber (attr= :type "mobile") text))})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment