I am trying to apply function for extracting content of one tag from xml on 
a collection of tags. Basically, I am trying to make a function that will 
extract content from xml, like this

(defn get-events[xz] 
 (map (juxt 
    #(zf/xml1-> % :title zf/text) 
    #(zf/xml1-> % :performers :performer :name zf/text) 
    #(zf/xml1-> % :start_time zf/text) 
     #(zf/xml1-> % :stop_time zf/text))
 (zf/xml-> xz  :events :event)))

And my solution so far looks like this

(ns datamodel
(:use [net.cgrand.enlive-html :as en-html ])(:require[clojure.zip :as z] 
[clojure.xml :as xml ][clojure.data.zip.xml :as zf]
 [clojure.java.io :as io]))

(def data-url "http://api.eventful.com/rest/events/search?   
app_key=4H4Vff4PdrTGp3vV&keywords=music&location=Belgrade&date=Future")
(defn xz [url](z/xml-zip (xml/parse url)))
(defn xml-zipper [& tags](zf/xml-> (xz data-url) tags))
(defn func [& tags](#(zf/xml1-> (xml-zipper tags) % zf/text)))
(def tags [:title :venue_name])

and in REPL when I try to apply func to tags like this

(map #((apply comp (reverse( func :events :event))) %) tags)

I get I am trying to apply function for extracting content of one tag from 
xml on a collection of tags. Basically, I am trying to make a function that 
will extract content from xml, like this

(defn get-events[xz] 
 (map (juxt 
    #(zf/xml1-> % :title zf/text) 
    #(zf/xml1-> % :performers :performer :name zf/text) 
    #(zf/xml1-> % :start_time zf/text) 
     #(zf/xml1-> % :stop_time zf/text))
 (zf/xml-> xz  :events :event)))

And my solution so far looks like this

(ns datamodel
(:use [net.cgrand.enlive-html :as en-html ])(:require[clojure.zip :as z] 
[clojure.xml :as xml ][clojure.data.zip.xml :as zf]
 [clojure.java.io :as io]))

(def data-url "http://api.eventful.com/rest/events/search?   
app_key=4H4Vff4PdrTGp3vV&keywords=music&location=Belgrade&date=Future")
(defn xz [url](z/xml-zip (xml/parse url)))
(defn xml-zipper [& tags](zf/xml-> (xz data-url) tags))
(defn func [& tags](#(zf/xml1-> (xml-zipper tags) % zf/text)))
(def tags [:title :venue_name])

and in REPL when I try to apply func to tags like this

(map #((apply comp (reverse( func :events :event))) %) tags)

I get I am trying to apply function for extracting content of one tag from 
xml on a collection of tags. Basically, I am trying to make a function that 
will extract content from xml, like this

(defn get-events[xz] 
 (map (juxt 
    #(zf/xml1-> % :title zf/text) 
    #(zf/xml1-> % :performers :performer :name zf/text) 
    #(zf/xml1-> % :start_time zf/text) 
     #(zf/xml1-> % :stop_time zf/text))
 (zf/xml-> xz  :events :event)))

And my solution so far looks like this

(ns datamodel
(:use [net.cgrand.enlive-html :as en-html ])(:require[clojure.zip :as z] 
[clojure.xml :as xml ][clojure.data.zip.xml :as zf]
 [clojure.java.io :as io]))

(def data-url "http://api.eventful.com/rest/events/search?   
app_key=4H4Vff4PdrTGp3vV&keywords=music&location=Belgrade&date=Future")
(defn xz [url](z/xml-zip (xml/parse url)))
(defn xml-zipper [& tags](zf/xml-> (xz data-url) tags))
(defn func [& tags](#(zf/xml1-> (xml-zipper tags) % zf/text)))
(def tags [:title :venue_name])

and in REPL when I try to apply func to tags like this

(map #((apply comp (reverse( func :events :event))) %) tags)

I get java.lang.IllegalArgumentException: Wrong number of args (0) passed 
to: datamodel$func$fn

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to